asp.net中的分页c# [英] Pagination in asp.net c#

查看:68
本文介绍了asp.net中的分页c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用带有ms sql server 2008的c#在asp.net中执行分页。

我想在不使用数据控件的情况下每页显示有限的记录。

I想要在标签或桌面上显示重复。

解决方案

如果您使用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 bleow

protected 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[^]


这篇关于asp.net中的分页c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆