Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
Gridview row color change on MouseOver..

Posted On: 12/08/2012 21:23:50
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='#FDCB0A';"); 
        e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=this.originalcolor;"); 
    }
}
Posted On: 12/08/2012 21:24:32
// 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';";
    }
}
Posted On: 12/08/2012 21:24:52
' VB.Net
Protected Sub gridView_RowDataBound(sender As Object, e As GridViewRowEventArgs)
 '
Creating hover effects on mouseover event for each row
 
If e.Row.RowType = DataControlRowType.DataRow Then
  e
.Row.Attributes("onmouseover") = "this.style.background='#D1DDF1';"

 
If (e.Row.RowIndex Mod 2) Is 0 Then
   
' if even row
   e.Row.Attributes("onmouseout") = "this.style.background='
#EFF3FB';"
 
Else
   
' alternate row
   e.Row.Attributes("onmouseout") = "this.style.background='
White';"
  End If
 End If
End Sub
MOST VIEWED QUESTION:
 
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us