简体   繁体   English

为什么AllowPaging = true; 根本不显示页码

[英]Why AllowPaging = true; isn't showing Page Numbering at all

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. 为什么我根本看不到页码,我100%肯定有5行以上,当我增加pageSize属性时可以看到它们。

添加代码:

GridView.PagerSettings.Mode = PagerButtons.Numeric;

如果要动态添加控件,则必须在调用DataBind()方法之前将控件添加到页面中,否则它不会显示页面数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM