Suppose,we have a Gridview called grid_project_details as below:-
<asp:GridView ID = "grid_project_details" runat = "server"
OnRowCreated = "grid_project_details_RowCreated">
</asp:GridView>
Now in the
OnRowCreated event we have to write below code:-
protected void grid_project_details_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//On Mouse Over Highlight Row set row color to yellow
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='yellow'");
//On Mouse out restore default row color i.e. white color
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
}
}
So,when we point our mouse on any row,color will be yellow and point out,then reset color as white.