Monday, October 29, 2012

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException

While working on Asp.Net application with Master Pages, Child pages and web user controls getting following error is very common. Which is related to Events related to Web user controls, e.g. Button click event...

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 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.

In such cases as error says we simply have to disable EventValidation in @Page directive and error disappears.

<%@ Page EnableEventValidation="false" %>
OR enable it for whole application by modifying it in web.config file

<%@pages enableeventvalidation="false">
<%@/pages>
Submit this story to DotNetKicks

Read more...