【2010】asp.net GridView分页的实现
时间:2010-10-05 来源:笑翱江湖
首先aspx页面中:
<asp:GridView ID="gdv" runat="server" AllowPaging="true" OnPageIndexChanging="GridView_PageIndexChanging" PageSize="16">
**************
</asp.GridView>
主要设置ID,AllowPaging="true",OnPageIndexChanging,PageSize默认为10
然后在aspx.cs中添加:
protected void GridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gdvUpgradeStudent.PageIndex = e.NewPageIndex;
DataTable dt = BLL.TeacherUpgrade.selectStudentUpgrade();//数据源
this.gdv.DataSource = dt;
this.gdv.DataBind(); //重新绑定GridView数据
}
相关阅读 更多 +