Hover in Gridviewrows using javascript in VB.NET

By bryan tugade

We can hover on gridview row using javascript onmouseover event. We can also change the color in code behind.

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
        Dim gv As GridViewRow
        For Each gv In GridView1.Rows

            If gv.RowType = DataControlRowType.DataRow Then

                 gv.Attributes.Add("onmouseover", "this.style.background='#3399FF';this.style.cursor='pointer';")
                 gv.Attributes.Add("onmouseout", "this.style.background='';")

             End If

        Next
    End Sub

Hover in Gridviewrows using javascript in VB.NET  (770 Views)