Highlighting Row of Gridview on Mouse Over in Asp.net

Rajesh_Kumar
Posted by Rajesh_Kumar under ASP.NET category on | Points: 40 | Views : 1058
Either we can write code on Gridview Rowcreated event or RowDataBound event.

protected void project_grid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Highlighting Row
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#F0D8D8'");

//Reset Row Color(White Color)
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
}
}

Comments or Responses

Login to post response