Datagrid Row Selection

T

Toby Riley

Any ideas on how i would select a row from a datagrid using a mouse click
event on the row. I need to set the selectedindex. I using the following
code to create a rollover as the mouse moves through the rows. All I need is
the bit to make the onclick event work.

Private Sub dgUserList_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgUserList.ItemDataBound

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
e.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='Silver'")
e.Item.Attributes.Add("onmouseout",
"this.style.backgroundColor='white'")
End If

End Sub

Thanks in advance

Toby
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top