how to change the color of grid row on mouse over in asp.net using c#

in this web programming tutorial you will learn that how to change the color of grid row on mouse over in asp.net using c#.
see the below code and just copy and past it in your aspx.cs file

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            /////changing row color onmouseover
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E9E9E9'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");    
        }
    }

Admin

A Software Engineer, Social Media Marketing Expert, writer,

Post a Comment

Previous Post Next Post