I have a GridView with multiple rows, and each row has a buttonfield:
<asp:UpdatePanel ID="udpWarnings" runat="server"><ContentTemplate><table width="100%"><tr><td><asp:Label ID="lblTitle" runat="server" Text="WARNINGS"></asp:Label></td></tr><tr><td><asp:GridView ID="gridWarnings" runat="server" AutoGenerateColumns="False"><Columns><asp:BoundField DataField="NAME" HeaderText="Name" /><asp:BoundField DataField="EID" HeaderText="ID" /><asp:BoundField DataField="DESC" HeaderText="Description" /><asp:BoundField DataField="DETECTION" HeaderText="Detection" /><asp:BoundField DataField="GENERATION" HeaderText="Generation" /><asp:ButtonField Text="Re-Print" ButtonType="Button" /></Columns></asp:GridView></td></tr></table></ContentTemplate></asp:UpdatePanel>
My source code handles the RowCommand callback:
Sub gridWarnings_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gridWarnings.RowCommand ' Convert the row index stored in the CommandArgument property to an Integer Dim index As Integer = Convert.ToInt32(e.CommandArgument) ' ... do stuff .... ' Create PDF Dim report As New ReportDocument() report.Load(Request.PhysicalApplicationPath & "\TheReport.rpt") Dim pdf As New BinaryReader(report.ExportToStream(ExportFormatType.PortableDocFormat)) ' Send PDF to the client Dim Response As HttpResponse = System.Web.HttpContext.Current.Response Response.Clear() Response.AddHeader("content-disposition", "attachment; filename=" & "Test.pdf") Response.ContentType = "application/pdf" Response.BinaryWrite(pdf.ReadBytes(Convert.ToInt32(pdf.BaseStream.Length))) Response.End() End Sub
But this causes a PageRequestManagerParserErrorException. I have successfully created and opened files before using a Button, and listing that button in the <triggers></triggers> block, but ButtonFields don't have an ID to specify in the AsyncPostBackTrigger.
Any suggestions about how to resolve this issue?