Last post Nov 11, 2010 05:53 AM by akshatsharma80
Mar 04, 2009 04:29 PM|cpaschen|LINK
I am using Visual Studio 2008. I have a default.aspx page that has an AJax Update Panel on it with a datagrid inside it. The datagrid has a LinkButton column and when the user clicks the data, the code behind does a Response.Redirect("myPage.aspx", true);
I get this error message after the Page_Load of the myPage fires. If I take the Update Panel off the default.aspx page, then it runs with no problems. Is there any solutions to keeping the update panel on the webpage and doing a response.redirect? The full
error message is this.
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.
Details: Error parsing near '
<!DOCTYPE html P'.
Mar 04, 2009 06:30 PM|jpuckett|LINK
The AJAX UpdatePanel requires a return that is un-filtered by any HttpModule or HttpHandler. Since the Response object uses an HttpHandler to handle the HttpResponse, the UpdatePanel will fire the error you see as a security precaution. (Imagine if I was
What you can do is add the btn as a PostBackTrigger. However, there's a caveat in that the LinkButton is inside the GridView so we have to do a bit of a work-around. Please check:
for info on how they did it.
Mar 04, 2009 06:32 PM|Omego2K|LINK
may I ask how this Response.Redirect code gets executing? Button click event? And also is the control that makes it execute in the update panel? if so make that true into a false and see if that helps.
Mar 04, 2009 07:09 PM|cpaschen|LINK
OK, so I read that other post on how to add the butotn as a PostBackTrigger but I'm confused. I added
to the update panels trigger.
Then, trying to follow that other post,where he said to
'in the html markup you need to add the following to the template button properties: add OnPreRender="addTrigger_PreRender"
There isn't a OnPreRender to either the asp:templateColumn or hte ItemTemplate so I added it the DataGrid, because that is the only place I could find an OnPreRender.
Then in code behind I added this
But this doesn't work. Can you tell me what I did wrong?
Mar 05, 2009 04:19 AM|jpuckett|LINK
AsyncPostBackTrigger is incorrect. It's actually required to be a PostBackTrigger. This is because we *don't want a partial postback; we are redirecting to a new execution thread*.
The idea is that on the linkbutton's PreRender event we're adding the NewScriptManager.RegisterPostBackControl(MyButton) -- there's no need to set it declaritively in the ASPX page, it won't find it anyway and will throw a runtime error because the LinkButton
is inside a databound templated control.
Mar 05, 2009 11:43 AM|cpaschen|LINK
I changed it to the PostBackTrigger and it works beautifully. I can't thank you enough!!!
Apr 07, 2010 01:09 AM|Chit Min Maung|LINK
Can I ask you a few? I also have encountered this problem. I can't find any solution on web.
http://forums.asp.net/t/1542142.aspx Here is my question.
I just want to know ... I used gridview and I have already populated the attachment information in this grid.
After thant I just want to when I click uploaded file name in second column, this file will download... like this...
so... in this grid i also used delete button in one row, one button... it is okay... but my download link didn't work... I can't understand.
pls help if you are okay...
May 25, 2010 05:58 PM|TajKhan|LINK
I am getting the same error but i did'nt find any solution yet..
You can refer my post here
Aug 21, 2010 08:14 AM|imranm|LINK
i am using autocomplete extender with updatepanel
auto complete extender worked normally but when i click to button then i get message in script resources
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.
Details: Error parsing near '=========758|updateP'.
if i use button is outside the panel it works.
but i want to use button with update panel its my requirement
Aug 21, 2010 08:24 AM|imranm|LINK
Nov 11, 2010 05:53 AM|akshatsharma80|LINK
Add a post back trigger