我正在使用gridview并且添加了分页..在excel中导出时我不想要分页号1 2 3 ..
<asp:GridView ID="mygrid" runat="server" AllowSorting="true" OnSorting="mygrid_Sorting"
AllowPaging="true" AutoGenerateColumns="False" CssClass="Gridview" OnPageIndexChanging="mygrid_PageIndexChanging">
<Columns>
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName"
HeaderStyle-Wrap="false">
</asp:BoundField>
<asp:BoundField DataField="AvailableQuantity" HeaderText="AvailableQuantity" SortExpression="AvailableQuantity"
HeaderStyle-Wrap="false">
</asp:BoundField>
<asp:BoundField DataField="ProductId" HeaderText="ProductId" SortExpression="ProductId"
HeaderStyle-Wrap="false">
</asp:BoundField>
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" Text="Export Data to Excel" OnClick="Button1_Click1" />
上面的网格允许分页,1 2 3是页码..当导出到excel时,它显示的是分页号码。如何删除excel中的分页号码
答案 0 :(得分:0)
在渲染之前 - 禁用分页,绑定数据然后渲染:
GridView1.AllowPaging = false;
GridView1.DataSource = ds; //Data Source
GridView1.DataBind();
GridView1.RenderControl(objHtmlTextWriter)