好吧,我想出来了。关键是要确保风格
.gridViewPager td
重写
.gridview td
. 此代码的大部分内容都归功于中选定的正确答案
this SO posting
. 这是整个Enchalada:
ASPX:
<asp:GridView ID="gvTerritories"
runat="server"
CssClass="gridview"
AutoGenerateSelectButton="True"
GridLines="None"
AllowPaging="true"
PageSize="10">
<HeaderStyle CssClass="gridViewHeader" />
<RowStyle CssClass="gridViewRow" />
<AlternatingRowStyle CssClass="gridViewAltRow" />
<SelectedRowStyle CssClass="gridViewSelectedRow" />
<PagerStyle CssClass="gridViewPager" />
</asp:GridView>
CSS:
.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;
}