Mouseover/Mouseout for Gridview cells

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
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top