Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 373
yahya kh Avatar asked Dec 09 '11 09:12

yahya kh


Video Answer


1 Answers

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.

like image 78
lnu Avatar answered Oct 08 '22 06:10

lnu