I have a gridview inside of an updatepanel and would like to allow the user to select a row which would generate a call to a class that outputs a stream back to the client. It looks like I can’t do this because the grid is inside of an update panel. Any ideas?
C#
protected void gvResults_SelectedIndexChanged(object sender, EventArgs e) { RMATagsReport rpt = new RMATagsReport(); rpt.GenerateReport(); }
ASP.NET
<asp:UpdatePanel ID='upResults' runat='server' ChildrenAsTriggers='false' UpdateMode='Conditional'> <ContentTemplate> <asp:GridView ID='gvResults' runat='server' AutoGenerateColumns='False' CellPadding='4' ForeColor='#333333' OnSelectedIndexChanged='gvResults_SelectedIndexChanged' Width='100%'> <RowStyle BackColor='#F7F6F3' ForeColor='#333333' /> <Columns> <asp:BoundField DataField='CSTNO' HeaderText='DEALER' /> <asp:BoundField DataField='ORDNO' HeaderText='RMA NUMBER' /> <asp:BoundField DataField='CSTORD' HeaderText='DEALER PO NUMBER' /> <asp:BoundField DataField='ORDDTE' HeaderText='ORDER DATE' /> <asp:BoundField DataField='INVDTE' HeaderText='INVOICE DATE' HtmlEncode='false' /> <asp:CommandField SelectText='Print RMA' ShowSelectButton='True' /> </Columns> <FooterStyle BackColor='#5D7B9D' Font-Bold='True' ForeColor='White' /> <PagerStyle BackColor='#284775' ForeColor='White' HorizontalAlign='Center' /> <SelectedRowStyle BackColor='#E2DED6' Font-Bold='True' ForeColor='#333333' /> <HeaderStyle BackColor='#3494CC' Font-Bold='True' ForeColor='White' HorizontalAlign='Left' /> <EditRowStyle BackColor='#999999' /> <AlternatingRowStyle BackColor='White' ForeColor='#284775' /> <EmptyDataTemplate> <span style='color: Red;'>No RMA Tags Found With Specified Criteria. </span> </EmptyDataTemplate> </asp:GridView> <div id='LoadingDiv' style='display: none; text-align: center;'> <img src='Graphics/Icons/loading_lg.gif' /> </div> <div id='ResultsDiv'> </div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID='btnSearch' EventName='Click' /> </Triggers>
I’m doing a response.redirect on the index change now with the new page handling the report generation… This seems to work OK.
EDIT
While this seems to work, I am still open to other possibilities as I don’t want to have a page that’s only purpose is to output this document.