我在gridview上的asp.net页面中使用bootstrap css,如下所示:
<asp:GridView SkinID="VacanciesGridView" Runat="server" AllowSorting="True" AutoGenerateColumns="False"
BorderWidth="0" GridLines="None" CssClass="table table-condensed table-striped table-bordered table-hover gridview" >
<RowStyle CssClass="gridRow1" />
<AlternatingRowStyle CssClass="gridRow2" />
</asp:GridView>
我正在尝试将自定义类应用于rowstyle并交替使用rowstyle。 Css类是这样的:
.gridview .gridRow1
{
background-color: #f4f5f8;
}
.gridview .gridRow2
{
background-color: #FFFFFF;
}
我注意到应用了gridviewrow2但未应用gridviewrow1 cssclass。我使用firebug进行了检查,发现正在使用bootstrap.css的css类:
.table-striped tbody > tr:nth-child(2n+1) > td, .table-striped tbody > tr:nth-child(2n+1) > th
{
}
如何覆盖此css类。我需要在mouseover和mouseout上使用gridview_rowcreated更改颜色,所以我希望能够覆盖上面的css类,以便显示gridRow1样式。
答案 0 :(得分:0)
你想从中实现什么?
您正在使用自己的rowstyle css
,同时尝试使用引导类,如table-hover和table-striped。请停止使用rowstyle
和alternating row style css.
您可以使用css stylesheet
覆盖引导类。
请使用其中一个选项,或者使用提供备用行条带的“table-striped
”引导CSS类,或者转到alternating row style CSS
,
当您同时应用这两者时,引导程序将覆盖您的CSS.
另外,我注意到,您正在以不寻常的方式使用CSS。你应该用这种方式。
.gridview1{}
干杯!!!