when I try,
GridView.PageSize = 5;
GridView.AllowPaging = true;
GridView.PageIndexChanging += new GridViewPageEventHandler(GridView_PageIndexChanging);
and I got this,
void GridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
if (GridView != null)
{
GridView.PageIndex = e.NewPageIndex;
GridView.DataBind();
}
}
Why I am not able to see page numbering at all, I am 100% sure there are more then 5 rows as when I increase pageSize property I can see them.
添加代码:
GridView.PagerSettings.Mode = PagerButtons.Numeric;
如果要动态添加控件,则必须在调用DataBind()方法之前将控件添加到页面中,否则它不会显示页面数。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.