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
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