Selecting Rows by Clicking Anywhere

G

Guest

I'm trying to setup a datagrid in a custom control where I can select the row
with the Select column hidden and have it call the "SelectIndexChanged"
event. In the "SelectIndexChanged" I just want to populate a textbox with an
item out of the selected row.

I've implemented what seems to be the standard approach such as shown below
to accomplishing this and the event works when selecting the select column
link, when I make it visible, however I can't get it to work when selecting
other parts of the row with the select column visible or not. What am I
missing or is there a better way to accomplish what I'm trying to do?

Thanks

Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBound
Dim itemType As ListItemType = e.Item.ItemType
If ((itemType = ListItemType.Pager) Or _
(itemType = ListItemType.Header) Or _
(itemType = ListItemType.Footer)) Then
Return
Else
Dim button As LinkButton = _
CType(e.Item.Cells(0).Controls(0), LinkButton)
e.Item.Attributes("onclick") = _
Page.GetPostBackClientHyperlink(button, "")
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

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top