本文介绍了如何在gridview中使用分页,请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:GridView ID="GridView1" runat="server" Width="491px" PageSize="2" AllowPaging="True" >
</asp:GridView>
并发生错误:The GridView ''GridView1'' fired event PageIndexChanging which wasn''t handled.
请帮帮我.
谢谢!
and an error occurred: The GridView ''GridView1'' fired event PageIndexChanging which wasn''t handled.
Please help me.
Thanks!
推荐答案
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataSource = myDataset;
DataGrid1.DataBind();
<asp:gridview id="grdOrder" runat="server" autogeneratecolumns="False" allowpaging="True" onpageindexchanging="grdOrder_PageIndexChanging ">
</asp:GridView>
//In Code Behind
protected void grdOrder_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
try
{
grdOrder.PageIndex = e.NewPageIndex;
grdOrder.DataSource = //Your Function to bind Data or DataSet
grdOrder.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}
这篇关于如何在gridview中使用分页,请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!