views:

948

answers:

2

Hello,

is there some way to force the gridview's pager to show up, even when there is only one page of data on screen?

I'm building a gridview-based control with a custom pager (w/dropdown for pagesize) and everything is working fine, except when user selects pagesize that is larger than the current row count of the grid. At that point the pager disappears. I've been googling this and i think that i should be doing something in override OnRowCreated...

Custom pager is added by overriding InitializePager. I'll be glad to provide more information if required!

greets, J.Arola

+1  A: 

Ok, that wasn't too hard :-)

Based on my initial testing the following did the trick:

GridViewRow pagerRow = (GridViewRow) this.BottomPagerRow;

if(pagerRow != null && pagerRow.Visible == false)
pagerRow.Visible = true;

I just added that to overridden OnPreRender, and lo, pager is visible, even when there is just one page page of data shown. Got to do some additional testing before i can be sure, though. Seems to simple to me.

greets,
J. Arola

juarola
Yeah, this is working as i wanted. I can provide additional information on my solution, if someone has similar problems!
juarola
mdresser
Oops, fixed that :-)
juarola
A: 

can u show more details on your solutions. It's not working for me.

aslan