How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Last year I wrote a fix for AJAX 1.0 on my old blog, looks like many people found it helpful, I wanted to make sure people understood that issue only happened with ASP.NET AJAX 1.0. I cannot reproduce the same problem with AJAX 3.5.

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"

UPDATE: setting enableEventValidation does not fix the problem in all the cases. The problem can be cause with a timer in your application as well.

Cheers

Al

Read it here

Published Tuesday, April 22, 2008 11:40 PM by albertpascual
Filed under: , , , , ,

Comments

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Thursday, July 17, 2008 11:16 AM by Don Kang

AJ,

Actually I am getting this error message.

I use godaddy and I have barely uploaded some test pages.

I use VS2008, .Net Framework 3.5 and Ajax 3.5.

I have a radiobuttonlist, and two dropdownlist.

When user selects radiobutton the content of my second dropdownlist changes (suppose to). This scenario works perfectly locally on my computer but when I publish it on the hosting server, I am getting this message.

Any suggestions you may have?

thanks

don kang

kangdon@hotmail.com

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Tuesday, September 02, 2008 6:41 AM by Chandra Mohan

Plz send me solution for this error

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Sunday, October 26, 2008 11:43 AM by Srinivasan

The solution for this issue is given in this link.

weblogs.asp.net/.../sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

hope this will solve your problem.

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Monday, November 10, 2008 1:44 AM by Dave

This solution is worthless, pasted all across the net, and worthless

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Saturday, November 15, 2008 5:51 AM by usm145

i am also facing the same problem. please some expert must help us.

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Friday, January 02, 2009 4:54 AM by Pranav Pintu

i agree with Mr Dave

(Monday, November 10, 2008 1:44 AM by Dave)

actually i tried all this things. but still getting error.

at local it works fine. but after deploying at godday acocount it isn't work :(

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Tuesday, June 02, 2009 9:00 AM by Balaji

any other clues. I am also getting same problem....

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Saturday, June 13, 2009 4:51 PM by Alex

I resolve my error using response.redirect instead of server.transfer /*works in my scenario*/

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Tuesday, August 04, 2009 2:27 AM by Nils

Yes.. i have also resolve my error using Response.redirect instead of server.transfer

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Thursday, September 17, 2009 7:56 PM by Helix

I get this error by just making repeated calls to an update panel, or when the session times out, even if the session isn't being used.

What the heck is up with this?!

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Thursday, October 08, 2009 5:12 AM by Chetan

when search network is not found then generate this error in browser.

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Tuesday, October 13, 2009 2:07 AM by r4 nds

I tried your solution.....dint worked for me.....any other possibility?

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Saturday, November 07, 2009 4:22 PM by pdm2

Ususally I'm able to convert a SqlDataSource to a DataView to bind to a new Gridview use Response.Write to send the Excel file to the user using StringWriter, triggered by an asp:button. Trying from a button in the UpdatePanel is not working even with enableEventValidation="false" and I still don't see how to do this after reading this whole thread and posts, that is without trying to decrypting the blob of data AJAX receives from the server.

Any tricks for me, or do I have to give up and move the button outside the update panel even though I don't want to in the layout?

~~~~~~~~

'VB Sub

Protected Sub btnDownload_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Dim sbFile as string = Now.ToString("yyyy-MM-dd").ToString( + ".xls"))

Dim dv As DataView = mySqlDataSource.Select(DataSourceSelectArguments.Empty)

DataViewToExcel(dv, sbFile.ToString)

End Sub

//C# Class void

public static void DataViewToExcel(DataView dv, string filename)

       {

//Convert SqlDataSource to DataView then export to excel for raw data without GridView formatting.

           if (dv.Count > 0)

           {

               if (dv.Count < 65536)

               {

                   //VerifyRenderingInServerForm(gv);

                   HttpContext.Current.Response.Clear();

                   HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");

                   HttpContext.Current.Response.Charset = "";

                   HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + filename.ToString());

                   System.IO.StringWriter TextWriter = new System.IO.StringWriter();

                   HttpContext.Current.Response.ContentType = "application/vnd.xls";

                   System.IO.StringWriter stringwrite = new System.IO.StringWriter();

                   HtmlTextWriter htmlwrite = new HtmlTextWriter(stringwrite);

                   GridView gv = new GridView();

                   gv.DataSource = dv;

                   gv.AllowPaging = false;

                   gv.AllowSorting = false;

                   gv.DataBind();

                   gv.RenderControl(htmlwrite);

                   HttpContext.Current.Response.Write(stringwrite.ToString());

                   HttpContext.Current.Response.End();

               }

               else

               {

                   //Msg.Text = "Too many rows - Export to Excel not possible";

               }

           }

       }

# re: How to fix Sys.WebForms.PageRequestManagerParserErrorException in AJAX 1.0

Saturday, November 07, 2009 5:12 PM by pdm2

Adding a trigger to the update panel outside the contenttemplate fixed my exel download from a button within the panel!

Thanks to Jonny Coder!

johnnycoder.com/.../export-gridview-to-excel-within-an-updatepanel

...

   </ContentTemplate>

   <Triggers>

       <asp:PostBackTrigger ControlID="btnExport" />

   </Triggers>

</asp:UpdatePanel>

...

Leave a Comment

(required) 
(required) 
(optional)
(required)