GridView Pager style

Hello,

I am writing a c# asp.net web application, using a gridview.
I see that i can change the style using  "PagerStyle", but how can i change only the style of the selected page and all of the page numbers?
I want it to be larger and bolder.

Thank you
RelegenceAsked:
Who is Participating?
 
Bob LearnedCommented:
Try this:

using System.Drawing;

...

this.gridView1.DataBind();

TableCell mainCell = this.gridView1.BottomPagerRow.Cells[0];
Table pager = mainCell.Controls[0];
TableRow pageRow = pager.Rows[0];

foreach (TableCell pageCell in pageRow.Cells)
{
   if (pageCell.Controls[0] is Label)
   {
      Label lbl = (Label)pageCell.Controls[0];
      lbl.Font.Size = new FontUnit(FontSize.Larger);
      lbl.ForeColor = Color.Red;
   }
}

Bob
0
 
DhaestCommented:
I guess you'll have to take a look at the GridView.BottomPagerRow Property

See: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.bottompagerrow.aspx
0
 
RelegenceAuthor Commented:
Thank you but i can't find there what I need - to change the style of the selected page only
0
 
RelegenceAuthor Commented:
just what I needed - Thank you very much :-)
0
 
trickstagalCommented:
Just thought I'd add this link for another solution for .net 2.0 using skins & css:
http://community.sgdotnet.org/blogs/chuawenching/archive/2007/02/16/ASP.NET-2.0-GridView-_2D00_-My-experience-on-skinning.aspx
Bascially the current selected page sits inside a span within the pager so you can get at it that way.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.