Posts tagged ‘Change color over gridview’

MouseOver background color effect in gridview

Solution : 1

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add(“onmouseover”, “this.originalcolor=this.style.backgroundColor;” + ” this.style.backgroundColor=’#0090CB’; this.style.color = ‘white'”);
e.Row.Attributes.Add(“onmouseout”, “this.style.backgroundColor=this.originalcolor; this.style.color = ‘black'”);
}
}

Solution : 2

#GridView1 tr.rowHover:hover
{
background-color: Yellow;
font-family: Arial;
font-size:12px;
}

<asp:gridview id=”GridView1″ runat=”server” enableviewstate=”false” rowstyle-cssclass=”rowHover” clientidmode=”Static” />

 

 

Advertisements