更新时间:2023-02-09 17:13:51
如果您使用Gridview等数据控件
,则可以提供分页功能请参阅分页,我们将集中讨论一些问题
1. AllowPaging =True
2. PageSize =8
3. OnPageIndexChanging =GridView1_PageIndexChanging
在gridview中,您可以使用
AllowPaging的属性处理pagin。 PageSize将允许工具不使用您想要在页面中显示的记录。
并处理代码端后面的OnPageIndexChanging事件。这将有助于您使用分页。
对于设计方面,请参阅下面< ; asp:GridView ID = GridView1 runat = server AllowPaging = True PageSize = 8 OnPageIndexChanging = GridView1_PageIndexChanging >
< / asp:GridView >
和背后的代码看得不好受保护 void GridView1_PageIndexChanging( object sender,GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindYourGridview();
}
关注一些链接
http://www.dotnetgallery.com /kb/resource12-How-to-implement-paging-and-sorting-in-aspnet-Gridview-control.aspx.aspx [ ^ ]
使用PageSize更改下拉列表进行GridView自定义分页 [ ^ ]
How to perform pagination in asp.net using c# with ms sql server 2008.
I want to show limited records per page bu without using data controls.
I want to show recoeds on label or on table.
Pagination can be provided if you are using data controls like Gridview
See for pagination we will concentrate about some points
1. AllowPaging="True"
2. PageSize="8"
3. OnPageIndexChanging="GridView1_PageIndexChanging"
In gridview you can work with pagin by the properties of
AllowPaging. PageSize will give facility to use no of records you want to display in a page.
And Handle the OnPageIndexChanging event behind the code side. Which will help you lot to work with paging.
For Design side see below<asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="8" OnPageIndexChanging="GridView1_PageIndexChanging"> </asp:GridView>
and Code behind see bleowprotected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; BindYourGridview(); }
Follow some Links
http://www.dotnetgallery.com/kb/resource12-How-to-implement-paging-and-sorting-in-aspnet-Gridview-control.aspx.aspx[^]
GridView Custom Paging with PageSize Change Dropdown[^]