Search This Blog

Friday, September 24, 2010

Styles-GridRowDataBound

aspx.cs
----------

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#94a8b7'");
// This will be the back ground color of the GridView Control
if (e.Row.RowIndex % 2 == 0)
{
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#d0d9e2'");
}
else
{
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#e7ebf0'");
}


}
}

No comments:

Post a Comment