我在 ASP.NET 和 c# 中工作。
我有gridview,我在单击按钮时绑定,也在弹出窗口中显示这个gridview。现在分页在我的gridview中不起作用,请帮我解决这个问题。
ASP:
<asp:GridView ID="GV_Order" runat="server" AllowPaging="true" AutoGenerateColumns="false" DataKeyNames="ProductCode" EmptyDataText="There are no data records to display."
BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px"
CellPadding="4" CellSpacing="2"
HeaderStyle-BackColor="Black" HeaderStyle-ForeColor="#FFD700" PageSize="5" OnPageIndexChanging="GV_Orderpageindexchanging" o>
代码隐藏:
protected void btn_click(object sender,eventargs e)
{
GV_Order.DataSource = dataset;
GV_Order.DataBind();
}
protected void GV_Orderpageindexchanging(object sender, GridViewPageEventArgs e)
{
GV_Order.PageIndex = e.NewPageIndex;
GV_Order.DataBind();
}