Development World

New Development Technologies , Computer Last News , Tips & Tricks , UI , CSS , HTML , ASP , C# , .net Framework , Patterns & Practices & etc

How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX

Most annoying issue with MS ASP.NET 2.0 Ajax  1.0 is the error Sys.WebForms.PageRequestManagerParserErrorException that will crash the web app. I found a great article from Eilon Lipton http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx to help you avoid the error.

 

You will encounter this issue when  mixing callbacks and postbacks, as callbacks do not use Response.Write and there is not complete Requests to the server.

 

This is a bug on the MS ASP.NET 2.0 AJAX 1.0, is not that you are doing something wrong, the framework cannot handle the request validation and the exception is thrown. I  found that you can catch the exception using the Script manager; information about it here: http://alpascual.com/blog/al/archive/2007/03/26/Code-Snip-_2200_Customizing-ScriptManager_2200_-to-detect-errors.aspx

 

Or better yet, you can disable the error by disabling the request validation. On top of the webform add: enableEventValidation="false"

 

Hope this helps somebody.

 

UPDATE: setting enableEventValidation does not fix the problem in all the cases.

 

Cheers All

Reference : http://alpascual.com/blog/al/archive/2007/04/26/How-to-fix-Sys.WebForms.PageRequestManagerParserErrorException-in-AJAX.aspx

نویسنده : Nasser Hajloo : ٢:۳٧ ‎ب.ظ ; ۱۳۸٧/٥/۱٦
Comments پيام هاي ديگران ()      لینک دائم