/////////////////// HTML
<asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound"
BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ForeColor="Black" GridLines="Horizontal" OnSelectedIndexChanged="OnSelectedIndexChanged" Height="153px"
Width="681px">
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
<asp:Label ID="msg" runat="server" Text=""></asp:Label>
/////////////////// CS
protected void
GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.backgroundColor='Lime';";
e.Row.Attributes["onmouseout"] = "this.style.backgroundColor='white';";
}
}
No comments:
Post a Comment