[英]paging for dynamically created gridview
Hi I'm creating gridviews dynamically in Page_Init
as per the received tables from the database as below , if I receive 4 tables then 4 gridviews will be generated 嗨,我根据从数据库中接收到的表,在Page_Init
动态创建gridviews,如下所示,如果我收到4个表,则将生成4个gridviews
GridView gd = new GridView();
gd.ID = "gdd" + i;
gd.AllowPaging = true;
gd.PageSize = 10;
gd.PageIndexChanging += new GridViewPageEventHandler(GridView_PageIndexChanging);
and my question is to how to do paging for it , any help would be appreciated and how to retain the values when postback 我的问题是如何对其进行分页,将不胜感激,以及回发时如何保留值
Use this 用这个
protected void GridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvCustomers.PageIndex = e.NewPageIndex;
PopulateCustomers();
}
For more information use Gridview paging example 有关更多信息,请使用Gridview分页示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.