// C#
protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Creating hover effects on mouseover event for each row
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.background='#D1DDF1';";
if ((e.Row.RowIndex % 2) == 0) // if even row
e.Row.Attributes["onmouseout"] = "this.style.background='#EFF3FB';";
else // alternate row
e.Row.Attributes["onmouseout"] = "this.style.background='White';";
}
}