How can I make the color change in a datagridview row when the user hovers over it? Currently, I am only able to get the gray rows to turn blue on hover, but I want this effect to apply to all rows except the footer as well. How can I achieve this without affecting the footer? Thank you for your assistance.
Below is my aspx code:
<asp:GridView ID="editingGrid" runat="server" AutoGenerateColumns="false" ShowFooter="false" DataKeyNames="componente_id"
ShowHeaderWhenEmpty="true" AllowPaging="True" OnPageIndexChanging="gridView_PageIndexChanging" OnRowDataBound = "OnRowDataBound" OnSelectedIndexChanged = "OnSelectedIndexChanged"
CellPadding="3" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
<PagerSettings Mode="Numeric" />
<Columns>
<asp:TemplateField HeaderText="Familia">
<ItemTemplate>
<asp:Label Text='<%# Eval("familia") %>' runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtfamilie" Text='<%# Eval("familia") %>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And here is my CSS and HTML:
:root {
--main-color: #1b9bff;
}
.mGrid {
width: 100%;
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse: collapse;
}
.mGrid td {
padding: 2px;
border: solid 1px #c1c1c1;
color: #000;
}
.mGrid th {
padding: 4px 2px;
color: #fff;
background: #424242 url(/images/grd_head.png) repeat-x top;
border-left: solid 1px #525252;
font-size: 0.9em;
}
.mGrid th:hover {
color: #1b9bff;
}
.mGrid .alt {
background: #c4c9d2 url(/images/rd_alt.png) repeat-x top;
}
.mGrid .alt:hover {
background-color: #1b9bff;
}
.mGrid .pgr {
background: #424242 url(/images/grd_pgr.png) repeat-x top;
}
.mGrid .pgr table {
margin: 5px 0;
}
.mGrid .pgr td {
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a {
color: #666;
text-decoration: none;
}
.mGrid .pgr a:hover {
color: #000;
text-decoration: none;
}
<table class="mGrid" cellspacing="0" cellpadding="3" id="PageContent_editingGrid" style="border-collapse:collapse;">
<tr>
<th scope="col">Familia</th>
<th scope="col">Marca</th>
<th scope="col">Tipo</th>
<th scope="col">Designacion</th>
<th scope="col">Referencia</th>
</tr>
<tr title="Haga clic para seleccionar esta fila." onclick="javascript:__doPostBack('ctl00$PageContent$editingGrid','Select$0')">
<td>
<span>circuito integrado</span>
</td>
<td>
<span id="PageContent_editingGrid_myText_0">Kemet</span>
</td>
<td>
<span>electronics</span>
</td>
<td>
<span>capteur</span>
</td>
<td>
<span>calle mayor</span>
</td>
</tr>
<tr class="alt" title="Haga clic para seleccionar esta fila." onclick="javascript:__doPostBack('ctl00$PageContent$editingGrid','Select$0')">
<td>
<span>circuito integrado</span>
</td>
<td>
<span id="PageContent_editingGrid_myText_0">Kemet</span>
</td>
<td>
<span>electronics</span>
</td>
<td>
<span>capteur</span>
</td>
<td>
<span>calle mayor</span>
</td>
</tr>
<tr class="pgr">
<td colspan="5">
<table>
<tr>
<td><span>1</span></td>
<td><a href="javascript:__doPostBack('ctl00$PageContent$editingGrid','Page$2')">2</a></td>
</tr>
</table>
</td>
</tr>
</table>