Mouseover/Mouseout for Gridview cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How does one set a Mouseover/Mouseout event on a cell in a GridView? I can
successfully assign these events to be active on a row in a GridView.

I can do this with a DataGrid, by adding code to the OnItemBoundDataGrid event
 
Sub CustomersGridView_RowDataBound(ByVal sender As Object, ByVal e As
GridViewRowEventArgs)

If e.Row.RowType = DataControlRowType.DataRow Then
'change the hover effect over the first cell in the row

e.Row.Cells(1).Attributes.Add("onmouseover","this.className='something'")

e.Row.Cells(1).Attributes.Add("onmouseout","this.className='somethingelse'")

End If

End Sub
 
That's exactly what I was looking for. Thanks!!

Phillip Williams said:
Sub CustomersGridView_RowDataBound(ByVal sender As Object, ByVal e As
GridViewRowEventArgs)

If e.Row.RowType = DataControlRowType.DataRow Then
'change the hover effect over the first cell in the row

e.Row.Cells(1).Attributes.Add("onmouseover","this.className='something'")

e.Row.Cells(1).Attributes.Add("onmouseout","this.className='somethingelse'")

End If

End Sub

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
 
Back
Top