Wednesday, April 18, 2012

ASP.NET AJAX - Invalid postback or callback argument

Sometimes when we have "web-serviced" control or some AJAX partial postbacks on the page, the events might be prevented from validation because the result is unexpected. MSDN quote about this issue like this:
Control registers its events during rendering and then validates the events during postback or callback handling. For example, if a list control includes options numbered 1, 2, or 3 when the page is rendered, and if a postback request is received specifying option number 4, ASP.NET raises an exception. All event-driven controls in ASP.NET use this feature by default.

Actually all that has to be done is to add this line either in the web.config file:

<pages validateRequest="false" enableEventValidation="false"></pages>

Or this line on any desired page:

<asp:Page EnableEventValidation="False" />


No comments:

Post a Comment