asp.net网格视图分页 [英] asp.net grid view paging

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

问题描述





我使用asp.net 2010来构建我的Web应用程序,我从数据库中获取数据并显示到gridview它有超过300行,这里我想使用分页。



我给出了属性AllowPaging = True和PageSize = 50,

在设计模式下在网格视图的底部显示像1,2这样的页面索引,但是当我运行到浏览器时,gridview只加载了50行但没有显示页面索引。





请帮忙..



谢谢..

Hi,

I am using asp.net 2010 to build my web application, I am fetching data from database and displaying to gridview it has more than 300 rows, here i want to use paging.

I have given the properties AllowPaging = True and PageSize = 50,
In the design mode its showing page index like 1,2 in the bottom of the gridview, but when i am running in to the browser the gridview loading only 50 rows but not showing page index.


Please help..

thanks..

推荐答案

I希望这会工作





在设计方面:



< asp:gridview id =GridView1runat =serverallowpaging =truepagesize =50onpageindexchanging =GridView1_PageIndexChanging>





在编码端:

protected void GridView1_PageIndexChanging(object sender,GridViewPageEventArgs e)

{

GridView1.PageIndex = e.NewPageIndex;

//在这里调用你的网格绑定数据方法

}
I hope This will Work


At Design Side:

<asp:gridview id="GridView1" runat="server" allowpaging="true" pagesize="50" onpageindexchanging="GridView1_PageIndexChanging">


At Coding Side:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
// call here your Grid Bind Data Method
}






我自己找到了解决方案。



我试图设置一些在RowCreated事件中,gridview单元格的可见性为false。删除此代码后,gridview分页工作正常...





谢谢。 ..
Hi,

I found the solution myself.

I was trying to set some of the gridview cells visibility to false in RowCreated Event.After removal of this code gridview paging is working fine...


Thanks...


检查这个

强制ASP.NET GridView的寻呼机显示 [ ^ ]


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

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