Gridview PagerStyle problem

Discussion in 'ASP .Net' started by kuangzhang@gmail.com, Oct 2, 2006.

  1. Guest

    Dear MS Gurus,
    I have read many posts on the Gridview pagerstyle problem but have yet
    to see a fix or an work around.
    Following is what I am experiencing:
    in the Aspx Page I have this <PagerStyle CssClass="PagerSytle"/>

    After render the Aspx page the HTML looks like this
    <tr class="PagerStyle" >
    <td colspan="9">
    <table border="0">
    <tr>
    <td><span>1</span></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$2')">2</a></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$3')">3</a></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$4')">4</a></td>
    </tr>
    </table>
    </td>
    </tr>

    >From the above it easy to see why the style is not taking an effect.

    With that said why is the gridview creating a subtable within the pager
    tr/td? I can I get to that table to apply an style on it. Any help
    would be greatly appreciated.
    PS. I am not very sharp to please be specific ïŠ Thanks.
    , Oct 2, 2006
    #1
    1. Advertising

  2. use css inhertance:

    <style>
    tr.PagerStyle table {color:red}
    tr.PagerStyle table tr {}
    tr.PagerStyle table tr td {}
    tr.PagerStyle table tr td span {color:blue}
    tr.PagerStyle a {color:green}
    </style>

    -- bruce (sqlwork.com)

    <> wrote in message
    news:...
    Dear MS Gurus,
    I have read many posts on the Gridview pagerstyle problem but have yet
    to see a fix or an work around.
    Following is what I am experiencing:
    in the Aspx Page I have this <PagerStyle CssClass="PagerSytle"/>

    After render the Aspx page the HTML looks like this
    <tr class="PagerStyle" >
    <td colspan="9">
    <table border="0">
    <tr>
    <td><span>1</span></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$2')">2</a></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$3')">3</a></td>
    <td><a
    href="javascript:__doPostBack('MyTasks$gvMy','Page$4')">4</a></td>
    </tr>
    </table>
    </td>
    </tr>

    >From the above it easy to see why the style is not taking an effect.

    With that said why is the gridview creating a subtable within the pager
    tr/td? I can I get to that table to apply an style on it. Any help
    would be greatly appreciated.
    PS. I am not very sharp to please be specific ? Thanks.
    bruce barker \(sqlwork.com\), Oct 2, 2006
    #2
    1. Advertising

  3. hoffe

    Joined:
    Mar 9, 2011
    Messages:
    1
    Solution to font-size in GridView Pager with .NET

    Since I couldn't find any solution, I had to find my own workaround.
    Add these lines in OnPreRender on the page where the GridView, here named "gvReport", is:

    protected override void OnPreRender(EventArgs e)
    {
    base.OnPreRender(e);
    if (null != gvReport.TopPagerRow)
    {
    ((Table)gvReport.TopPagerRow.Cells[0].Controls[0]).Style.Add(HtmlTextWriterStyle.FontSize, "10pt");
    }
    if (null != gvReport.BottomPagerRow)
    {
    ((Table)gvReport.BottomPagerRow.Cells[0].Controls[0]).Style.Add(HtmlTextWriterStyle.FontSize, "10pt");
    }
    }


    Happy coding!
    Lars
    hoffe, Mar 9, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aftab
    Replies:
    0
    Views:
    772
    aftab
    May 15, 2004
  2. Kiki

    PagerStyle PageLabel problem

    Kiki, Sep 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,831
    Martin Dechev
    Sep 23, 2004
  3. Larry  Viezel

    Customizing PagerStyle in a datagrid

    Larry Viezel, Aug 10, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    666
    Larry Viezel
    Aug 10, 2005
  4. =?Utf-8?B?S2FtZW4=?=

    GridView and PagerStyle problem

    =?Utf-8?B?S2FtZW4=?=, May 31, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    13,822
    Harry
    Nov 17, 2006
  5. Anil TG

    Visibility of GridView Pagerstyle

    Anil TG, Feb 1, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    413
    Anil TG
    Feb 1, 2008
Loading...

Share This Page