Protected Sub GridView1_RowCreated(...) Handles GridView1.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
Dim colorNormalRow As String = jsColor(GridView1.RowStyle.BackColor)
Dim colorAltRow As String = jsColor(GridView1.AlternatingRowStyle.BackColor)
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue';")
If e.Row.RowState = DataControlRowState.Normal Then
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='" & colorNormalRow & "';")
End If
If e.Row.RowState = DataControlRowState.Alternate Then
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='" & colorAltRow & "';")
End If
End If
End Sub
Protected Sub GridView1_SelectedIndexChanged(...) Handles GridView1.SelectedIndexChanged
Dim colorNormalRow As String = jsColor(GridView1.RowStyle.BackColor)
Dim colorAltRow As String = jsColor(GridView1.AlternatingRowStyle.BackColor)
Dim colorSelRow As String = jsColor(GridView1.SelectedRowStyle.BackColor)
For Each row As GridViewRow In GridView1.Rows
If row.RowState = DataControlRowState.Normal Then
row.Attributes.Add("onmouseout", "this.style.backgroundColor='" & colorNormalRow & "';")
End If
If row.RowState = DataControlRowState.Alternate Then
row.Attributes.Add("onmouseout", "this.style.backgroundColor='" & colorAltRow & "';")
End If
Next
GridView1.SelectedRow.Attributes.Add("onmouseout", "this.style.backgroundColor='" & colorSelRow & "';")
End Sub