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
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!!
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
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
Thanks the problem was k it was written in update panel thanks alex
Karan Mistry
February 28, 2013 at 6:52 am
Thanks its working
prasad
March 1, 2013 at 6:38 am
Thanks its working ..
xyz
April 2, 2013 at 4:10 am
Good Its working..Thanks…
sreekar
April 2, 2013 at 11:54 pm