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

507 Views Asked by At

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.

2

There are 2 best solutions below

0
Ramin Asadi On

add in code:

GridView.PagerSettings.Mode = PagerButtons.Numeric;
0
sandeces On

If you are adding your control dynamically, you will have to add your control to your page BEFORE you call your DataBind() method, otherwise it won't show the numer of pages.