Monday, August 7, 2017

// // Leave a Comment

How to display mouseover effect in GridView rows VB


Data bind Gridview as previous projects. Watch Video

Click on the Gridview and open the property windows and click on Event icon.


Double click on RowCreated Event, coding window will open. and past the below code.

 Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
     
        Dim RowValue As Decimal
        RowValue = Decimal.Remainder(e.Row.RowIndex, 2)

        If Not e.Row.RowIndex = -1 Then
            e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor = 'lightsteelblue';")

        End If

        If RowValue = 0 And Not e.Row.RowIndex = -1 Then
            e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = '';")

        ElseIf Not RowValue = 0 And Not e.Row.RowIndex = -1 Then
            e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor = '';")

        End If
    End Sub


Watch Video























0 comments:

Post a Comment