Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok, I figured it out. The key was to make sure to style <code>.gridViewPager td</code> to override <code>.gridview td</code>. Credit for the majority of this code goes to the selected correct answer in <a href="https://stackoverflow.com/questions/607547/define-global-site-style-for-aspgridview-with-plain-css-without-using-vs-skins">this SO posting</a>. Here is the whole enchalada:</p> <p>.aspx:</p> <pre><code>&lt;asp:GridView ID="gvTerritories" runat="server" CssClass="gridview" AutoGenerateSelectButton="True" GridLines="None" AllowPaging="true" PageSize="10"&gt; &lt;HeaderStyle CssClass="gridViewHeader" /&gt; &lt;RowStyle CssClass="gridViewRow" /&gt; &lt;AlternatingRowStyle CssClass="gridViewAltRow" /&gt; &lt;SelectedRowStyle CssClass="gridViewSelectedRow" /&gt; &lt;PagerStyle CssClass="gridViewPager" /&gt; &lt;/asp:GridView&gt; </code></pre> <p>CSS:</p> <pre><code>.gridview { font-family: Arial; background-color: #FFFFFF; border: solid 1px #CCCCCC; } .gridview td { padding: 5px 50px 5px 5px; } .gridview th { padding: 5px 50px 5px 5px; text-align: left; } .gridview th a{ color: #003300; text-decoration: none; } .gridview th a:hover{ color: #003300; text-decoration: underline; } .gridview td a{ color: #003300; text-decoration: none; } .gridview td a:hover { color: red; text-decoration:underline; } .gridViewHeader { background-color: #0066CC; color: #FFFFFF; text-align: left; } .gridViewRow { background-color: #99CCFF; color: #000000; } .gridViewAltRow { background-color: #FFFFFF; } .gridViewSelectedRow { background-color: #FFCC00; color: #666666; } /* Of course, this doesn't work with IE6. Works fine with Firefox, though. */ .gridview tr.gridViewRow:hover td, .gridview tr.gridViewAltRow:hover td { background-color: #CCCCCC; color: #000000; } .gridViewPager { background-color: #0066CC; color: #FFFFFF; text-align: left; } .gridViewPager td { padding: 3px; } .gridViewPager td a { color: #FFFFFF; text-decoration: none; } .gridViewPager td a:hover { color: #FFFFFF; text-decoration: underline; } /* The currently selected page number is rendered by ASP.NET in a span tag in the td. */ .gridViewPager span { color: #000000; } #divGridView { margin-top: 1.5em; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload