Thursday, March 17, 2011

VB.NET OnmouseOver GridView Rowcolor Change [With CSS]

 //CSS Class Used to Highlight GridView Row

.rowStyle {
    background-color:#AAFFEE;
    cursor:pointer;
}

//VB.Net Code for GridView Highlight Row onmouseover

GridView1.DataSource = myDataSet
GridView1.DataBind() For Each rowItem As GridViewRow In GridView1.Rows
    rowItem.Attributes.Add("onmouseover", "javascript:this.className = 'rowStyle'")
    rowItem.Attributes.Add("onmouseout", "javascript:this.className = ''")
Next

No comments: