Invalid postback or callback argument error?

I have two dropdownlists and I am filling one based on the other using javascript. In my javascript code I am calling for a webservice and with the results returned I fill the other dropdownlist. The problem is that after I have done that successfully the following error started to occur:

Invalid postback or callback argument. Event validation is enabled
using in configuration or <%@
Page EnableEventValidation=”true” %> in a page. For security
purposes, this feature verifies that arguments to postback or callback
events originate from the server control that originally rendered
them. If the data is valid and expected, use the
ClientScriptManager.RegisterForEventValidation method in order to
register the postback or callback data for validation.

Any idea ?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

If you want to modify generated controls from client side, you have to disable eventvalidation or register all possible values with RegisterForEventValidation.
It’s well explained here.
It’s because the data sent to the client and received after by the server differs.

edit:also responded here.

Method 2

I got same Error when i got one of my clients project. It is related to the web.config file. Simply Paste the below code under appSettings in config file.

<add key="PageInspector:ServerCodeMappingSupport" value="Disabled" />

Method 3

I had to change the web.config in IIS

<configuration>
    <system.web>
        <pages enableEventValidation="false"/>
    </system.web>
</configuration>

Method 4

My problem was solved when cancel event at end of grid event at server side.

protected void grdEducation_RowEditing(object sender, GridViewEditEventArgs e)
{
  // do your processing ... 

  // at end     
  e.Cancel = true;
}


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x