Learn how to a build a cloud-first strategyRegister Now


GridView Pager style

Posted on 2007-07-31
Medium Priority
Last Modified: 2008-01-09

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
Question by:Relegence
LVL 53

Expert Comment

ID: 19598368
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

Author Comment

ID: 19598881
Thank you but i can't find there what I need - to change the style of the selected page only
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 19600155
Try this:

using System.Drawing;



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;


Author Comment

ID: 19600250
just what I needed - Thank you very much :-)

Expert Comment

ID: 20190666
Just thought I'd add this link for another solution for .net 2.0 using skins & css:
Bascially the current selected page sits inside a span within the pager so you can get at it that way.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question