Question

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

When I select a value for the PageSize that is greater than the row count for the grid the Pager is disappearing from both the top & bottom of the grid.

Anyone got any ideas why?

I'm using a custom PageTemplate element in the aspx page.

Cheers

Ollie

Was it helpful?

Solution

Behaviour is by design. You can force it to remain visible by setting the Visible property of the pager row (accessed using either TopPagerRow or BottomPagerRow property) in the grid's OnDataBound event. For example:

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

OTHER TIPS

I found that this happens if you are trying to force a column to be invisible. for example if you use:

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

You can cause the pager to render invisible.

You should use this code instead:

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

When the number of pages is one, there is no need to show Next/Previous or other pages. Sounds like normal behavior to me.

the Issue is Related to Design so Please Go to The Properties of Rad Grid View and Just Change The Property : Style-->PagerStyle-->AlwaysVisible To (True)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top