Changing the Row Color on the mouseover event in GridView Control

Pretty simple idea to change the row color of the GridView control on the onmouseover event.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'");
            // This will be the back ground color of the GridView Control
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
        }
    }

Print | posted @ Monday, November 07, 2005 9:57 PM

Twitter