datalist attributes.add

S

Scott Reynolds

Hello!

I am trying to add onMouseOver attribute to each DataList item, but can't
get it work...

Somebody said that this is a bug in DataList control, if so, is there a
workaround for this?

Thank you in advance!
Scott

-------------- CODE -----------------

Private Sub myDL_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles myDL.ItemDataBound

Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)

If Not drv Is Nothing Then

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='#ff0000'")
End If

End If

End Sub
 

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,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top