GridView Pager style

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

I am writing a c# 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

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


    Author Comment

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

    Accepted Solution

    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

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

    Expert Comment

    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 Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
    If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
    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… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now