Asp.net GridView Pager disappears!

I have a datagridview that uses paging, it works fine, and I have a drop-down list that allows the user to change the "PageSize" property - 10, 15, 25, 50, 100, 1000, etc.

When I select a value for the PageSize parameter that is larger than the number of lines for the grid, the pager disappears from the top and bottom of the grid.

Anyone have any ideas why?

I am using a custom PageTemplate element on an aspx page.

Greetings

Ollie

+4
source share
4 answers

Design Behavior. You can make it remain visible by setting the Visible property of the pager line (available using the TopPagerRow or BottomPagerRow property) in the OnDataBound event of the grid. For instance:

protected void grid_DataBound(object sender, EventArgs e) { grid.TopPagerRow.Visible = true; } 
+7
source

I found this to happen if you are trying to make the column be invisible. for example, if you use:

e.Row.Cells [0] .Visible = false;

You can make the pager display invisible.

Instead, you should use this code:

if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header) {e.Row.Cells [0] .Visible = false; }

+4
source

When the number of pages is one, there is no need to show the next / previous or other pages. For me, this seems like normal behavior.

0
source

The problem is with the design, so please go to the β€œRad Grid Properties” and just change the property: Style β†’ PagerStyle β†’ AlwaysVisible To (True)

0
source

All Articles