Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error on clicking Linkbutton of Gridview

Error on clicking Linkbutton of Gridview

Scheduled Pinned Locked Moved ASP.NET
helpsysadmintutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sudevsu
    wrote on last edited by
    #1

    How to solve this error Error:

    Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

    My ASPX:

    <asp:UpdatePanel ID="Upnl1" runat="server">
    <Triggers>
    <asp:PostBackTrigger ControlID="btnAddLineItems" />
    </Triggers>
    <ContentTemplate>
    <div>
    </div>
    asp:panel
    <table>
    txt1
    txt2
    ddl1
    ddl2
    File upload
    Button Add new Items
    </table>
    </asp:panel>

    <asp:updatepanel>
        <ContentTemplate>
        <Gridview>
        <Boundfield 1=txt1>
        <Boundfield 2=txt2>
        <Boundfield 3=ddl1>
        <Boundfield 4=ddl3>
        <Templatefield Link button="Download">
        </Gridview>
        </ContentTemplate>
    <asp:updatepanel>
    

    </ContentTemplate>
    </asp:UpdatePanel>

    LinkbuttonClick Event:

    Dim filePath As String = CType(sender, LinkButton).CommandArgument
    Response.ContentType = ContentType
    Response.AppendHeader("Content-Disposition", ("attachment; filename=" + Path.GetFileName(filePath)))
    Response.WriteFile(filePath)
    Response.End()

    Your help is much appreciated. Thanks Happy Coding!

    S A 2 Replies Last reply
    0
    • S sudevsu

      How to solve this error Error:

      Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

      My ASPX:

      <asp:UpdatePanel ID="Upnl1" runat="server">
      <Triggers>
      <asp:PostBackTrigger ControlID="btnAddLineItems" />
      </Triggers>
      <ContentTemplate>
      <div>
      </div>
      asp:panel
      <table>
      txt1
      txt2
      ddl1
      ddl2
      File upload
      Button Add new Items
      </table>
      </asp:panel>

      <asp:updatepanel>
          <ContentTemplate>
          <Gridview>
          <Boundfield 1=txt1>
          <Boundfield 2=txt2>
          <Boundfield 3=ddl1>
          <Boundfield 4=ddl3>
          <Templatefield Link button="Download">
          </Gridview>
          </ContentTemplate>
      <asp:updatepanel>
      

      </ContentTemplate>
      </asp:UpdatePanel>

      LinkbuttonClick Event:

      Dim filePath As String = CType(sender, LinkButton).CommandArgument
      Response.ContentType = ContentType
      Response.AppendHeader("Content-Disposition", ("attachment; filename=" + Path.GetFileName(filePath)))
      Response.WriteFile(filePath)
      Response.End()

      Your help is much appreciated. Thanks Happy Coding!

      S Offline
      S Offline
      sudevsu
      wrote on last edited by
      #2

      I solved this by adding

      Dim scriptManager As ScriptManager = scriptManager.GetCurrent(Me.Page)
      scriptManager.RegisterPostBackControl(Me.gdvLineItems)

      in PageLoad. gdvLineItems is the Grid that has my linkbutton

      Your help is much appreciated. Thanks Happy Coding!

      1 Reply Last reply
      0
      • S sudevsu

        How to solve this error Error:

        Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

        My ASPX:

        <asp:UpdatePanel ID="Upnl1" runat="server">
        <Triggers>
        <asp:PostBackTrigger ControlID="btnAddLineItems" />
        </Triggers>
        <ContentTemplate>
        <div>
        </div>
        asp:panel
        <table>
        txt1
        txt2
        ddl1
        ddl2
        File upload
        Button Add new Items
        </table>
        </asp:panel>

        <asp:updatepanel>
            <ContentTemplate>
            <Gridview>
            <Boundfield 1=txt1>
            <Boundfield 2=txt2>
            <Boundfield 3=ddl1>
            <Boundfield 4=ddl3>
            <Templatefield Link button="Download">
            </Gridview>
            </ContentTemplate>
        <asp:updatepanel>
        

        </ContentTemplate>
        </asp:UpdatePanel>

        LinkbuttonClick Event:

        Dim filePath As String = CType(sender, LinkButton).CommandArgument
        Response.ContentType = ContentType
        Response.AppendHeader("Content-Disposition", ("attachment; filename=" + Path.GetFileName(filePath)))
        Response.WriteFile(filePath)
        Response.End()

        Your help is much appreciated. Thanks Happy Coding!

        A Offline
        A Offline
        Atish K Singh
        wrote on last edited by
        #3

        Add below code in page_load event of the page

        ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
        scriptManager.RegisterPostBackControl([GridView's LinkButton ID]);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups