----------------------------------------------------------------
Change row color in Gridview on mouse over
If you have the need to change the row color of a row in a gridview when you mouse over (and mouse out) you can add some code to the RowDataBound event.
Here is a sample:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//Only apply to data rows
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Add mouse over event to change row background color
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor=’Yellow’");
//Add mouse out event to change row background color back to white
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=White");
}
}
-----------------------
Saturday, October 2, 2010
Change row color in Gridview on mouse over
Saturday, October 02, 2010 Posted by Vikas SharmaLabels: GeneralTips n Tricks
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment