【发布时间】:2015-03-29 00:48:10
【问题描述】:
我正在尝试将活动类添加到 GridView。一旦我在网格中选择了一行,我想使用 Bootstrap 将其设置为选中状态。以前人们可能会问过它。但我找不到这个。
网格视图:
<div class="row">
<asp:UpdatePanel ID="UpdatePanelGrid" runat="server">
<ContentTemplate>
<div class="history-table ">
<asp:GridView CssClass="col-lg-6 col-md-8 col-sm-10 col-xs-12" DataKeyNames="HistoryId" ID="gvFunds" runat="server"
AutoGenerateColumns="False" OnSelectedIndexChanged="gvFunds_SelectedIndexChanged" OnRowDataBound="gvFunds_RowDataBound">
<Columns>
<asp:BoundField DataField="HistoryId" Visible="false" />
<asp:BoundField DataField="Date" HeaderText="Date" ReadOnly="True" />
<asp:BoundField DataField="Time" HeaderText="Time" ReadOnly="True" />
<asp:BoundField DataField="UserId" HeaderText="User ID" ReadOnly="True" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
CSS:
.history-table table {
text-align: center;
border: none;
}
.history-table table tr:nth-child(2n+1) {
background-color: #C6C0AA;
}
.history-table table tr th {
text-align: center;
height: 35px;
border: none;
background-color: #C6C0AA;
}
.history-table table td {
height: 25px;
border: none;
}
.history-table table tr:hover {
background-color: #8A2A2A;
color: #FFF;
cursor: pointer;
}
.history-table table tr:first-child:hover {
color: #000;
}
【问题讨论】:
标签: asp.net c#-4.0 gridview twitter-bootstrap-3