The Temple of Fu

code, systems and games

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Ajax Toolkit – Update Panel and Datagrid download button

with 8 comments

So I have a datagrid which is a listing of files in a network share. I have a linkbutton in the grid with its text property set to a filename. This datagrid sits inside an UpdatePanel so it is all ‘Ajaxified’. When testing the command on the link button I received the following error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Now I do understand why I received this error, I had modified the output stream back to the client via AddHeader methods etc but I need to in order to get this file back to client!

Well fortunately there is a way to tell the Ajax parser code on the client that content coming back was modified on the server side via script manager and also by registering the datagrid as a postback control.

ScriptManager _scriptManager = ScriptManager.GetCurrent(this.Page); _scriptManager.RegisterPostBackControl(myDataGridID);

Hope this helps!!

Advertisements

Written by lordfu

September 24, 2010 at 2:11 pm

Posted in Ajax, ASP.Net, C#, Development

8 Responses

Subscribe to comments with RSS.

  1. hi i tried to keep that code of registerscript in rowcommand of gridview but it gives the same error. could you please suggest me how top solve this ajax error.

    Thanks in advance

    shaik

    June 9, 2011 at 8:16 am

    • protected void Page_Load(object sender, EventArgs e)
      {
      ScriptManager _scriptManager = ScriptManager.GetCurrent(this.Page);
      _scriptManager.RegisterPostBackControl(gridworkpermit);
      if (!IsPostBack)
      {
      Loadworkpermit();
      }
      }

      stanly

      March 14, 2012 at 4:22 am

  2. Make sure you have a trigger set in the update panel.

    Alex Kennedy

    April 18, 2012 at 9:02 am

    • Yeah its working wonderfully to me thanks for such a nice post.

      Pradeep Pednekar

      January 21, 2013 at 7:13 am

  3. Thanks the problem was k it was written in update panel thanks alex

    Karan Mistry

    February 28, 2013 at 6:52 am

  4. Thanks its working

    prasad

    March 1, 2013 at 6:38 am

  5. Thanks its working ..

    xyz

    April 2, 2013 at 4:10 am

  6. Good Its working..Thanks…

    sreekar

    April 2, 2013 at 11:54 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: