Hello,
I have a new functionality that I have to add to my ASP.NET solution and I could use some help.
What I need to do is to select some records from a gridview (based on select checkbox) and export those records to an excel file.
Here's my gridView:
- <asp:GridView ID="gv" runat="server" AutoGenerateColumns="false" ShowFooter="true"
- OnPageIndexChanging="gv_PageIndexChanging" AllowPaging="True" PageSize="20">
- <Columns>
- <asp:TemplateField HeaderText="S/N" ItemStyle-Width="25">
- <ItemTemplate>
- <asp:Label ID="lblrownum" runat="server" Text='<%#Eval("rownum") %>' Width="25"></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Appno">
- <ItemTemplate>
- <asp:Label ID="lblAppNo" runat="server" Text='<%#Eval("Appno") %>' Width="40"></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="IDNO">
- <ItemTemplate>
- <asp:Label ID="lblIDNO" runat="server" Text='<%#Eval("IDNO") %>' Width="40"></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Select" >
- <ItemTemplate>
- <asp:CheckBox ID="cbSelected" runat="server" />
- </ItemTemplate>
- </asp:TemplateField>
- </Columns>
- <PagerStyle HorizontalAlign="Left" VerticalAlign="Middle"/>
- </asp:GridView>
-
- <asp:Button ID="btnExport" runat="server" Text="Export to Excel" />
Any kind of help would be appreciated.
Thank you in advnce.