0

I have a gridview and it has a download button. All functionalities are working fine except the download file as it has response.write and I am getting the patent error of "Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.".

Here is the code: Backend:

    LinkButton downloadURL = (LinkButton)e.Row.FindControl("lnkButton");
    ScriptManager.GetCurrent(this).RegisterPostBackControl(downloadURL);

front end:

    <asp:LinkButton ID="lnkButton" runat="server" CausesValidation="False"       CommandName="Download" CommandArgument='<%# Bind("URL")%>'OnClientClick="return confirm('Are you certain you want to >Download this ?');"> </asp:LinkButton>
ARP
  • 21
  • 5

2 Answers2

1

In case anyone is also having the same problem, I found the solution to it.

The reason the postback wasnt working was because of few other controls that were reloading and making the controls async(as I wasnt binding them at every click).

So I changed to if(Ispostback) and checked which control was causing full postback and readded the postback trigger.

ARP
  • 21
  • 5
0

Have you read this? It's written by the guy who wrote the error message you're seeing!

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

Also the following question may have some answers:

ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException

Community
  • 1
  • 1
Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
  • Thanks Chris for the reply....I tried the first link but I am already using Postbackcontrol which didnt help. Also I have like 15-20 links in every grid so on every click setting hidden variable wouldnt be much helpful. Please advice! – ARP Nov 13 '15 at 03:00