我有一个 asp.net 网格视图,我的结构是这样的..
<asp:GridView ID="gridContractor" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CssClass="GridViewStyle" GridLines="None" EnableModelValidation="True"
DataKeyNames="DeviceID" OnRowCommand="gridContractor_RowCommand" OnPageIndexChanging="gridContractor_PageIndexChanging"
Width="100%" EmptyDataText = "No records to display">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderText="Device IMEI" DataField="DeviceID" Visible="false">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="175" />
</asp:BoundField>
<asp:BoundField HeaderText="Person Name" DataField="PersonName">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField HeaderText="#Observations" DataField="GpsPointsCount" ControlStyle-Width="50px">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" Width="50" />
</asp:BoundField>
<asp:BoundField HeaderText="#Violations" DataField="ViolationCount" ControlStyle-Width="60px">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Right" VerticalAlign="Middle" Width="60" />
</asp:BoundField>
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50">
<ItemTemplate>
<asp:Button ID="btnEdit" runat="server" Text="View" CommandName="View" Enabled="true"
CommandArgument="<%#Bind('DeviceID') %>" />
</ItemTemplate>
<HeaderStyle Width="50" />
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>
即使我指定了<SelectedRowStyle CssClass="SelectedRowStyle">
哪个是外部 Css,我也无法看到所选行背景颜色的变化
我也尝试过这样做<SelectedRowStyle BackColor="AliceBlue" />
,但仍然没有任何变化,有人能告诉我为什么这不起作用吗?