Reputation: 150
I've got a normal ASP.NET gridview with a custom pagertemplate and would like to display a different content in top pager than in the bottom pager.
Imaging you want to display a normal Pager in to Bottom Pager and the total number of record inside the top pager.
Now, there are a couple of solutions I could think of:
What else could I try? Has anyone done somehting similar?
Cheers, Mike
Upvotes: 1
Views: 1094
Reputation: 4803
You could ovveride the initialize pager method of the grid view to create different top/bottom pagers. But doing so would involve generating HTML in the codebehind which is a pain.
protected override void InitializePager(GridViewRow row,
int columnSpan,
PagedDataSource pagedDataSource)
{
//if (this.TopPagerRow == null &&
if (this.Controls[0].Controls.Count == 0 &&
(this.PagerSettings.Position == PagerPosition.Top ||
this.PagerSettings.Position == PagerPosition.TopAndBottom))
{
InitializeTopPager(row, columnSpan, pagedDataSource);
}
else
{
base.InitializePager(row, columnSpan, pagedDataSource);
InitializeBottomPager(row, columnSpan, pagedDataSource);
}
}
Ref: http://www.codeproject.com/Articles/28910/Custom-GridView-with-Paging-and-Filtering
I'm not sure of a slick way you can do it with a top/bottom pager template
Upvotes: 1