Private Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
'be sure that you're responding to the right kind of row
'=======================
'DATA row
'=======================
If TypeOf e.Item Is GridDataItem Then
If e.CommandName = "Select" Then
'cast e.item
Dim item As GridDataItem = e.Item
'requires that the referenced field be in the DataKeyValues in the grid
Session("itemnmbr") = RadGrid1.MasterTableView.DataKeyValues(e.Item.ItemIndex)("itemnmbr")
'get a reference to a GridButtonColumn
Dim btnSopnumber As LinkButton = CType(item("sopnumbe").Controls(0), LinkButton)
btnSopnumber.Enabled = False
End If
End If
'=======================
'GROUP row
'=======================
If TypeOf e.Item Is GridGroupHeaderItem Then
If e.CommandName = "Select" Then
'requires that the referenced field be in the DataKeyValues in the grid
Dim intFirstChildRowIndex As Int32 = CType(e.Item, GridGroupHeaderItem).GetChildItems.First.ItemIndex
Session("itemnmbr") = RadGrid1.MasterTableView.DataKeyValues(intFirstChildRowIndex)("itemnmbr")
End If
End If
End Sub
If TypeOf e.Item Is GridDetailTemplateItem Then
'requires that the referenced field be in the DataKeyValues in the grid
Dim intFirstChildRowIndex As Int32 = CType(e.Item, GridDetailTemplateItem).RowIndex
Dim strSopnumber As String = RadGrid1.MasterTableView.DataKeyValues(intFirstChildRowIndex)("sopnumbe")
Dim intSoptype As Int16 = RadGrid1.MasterTableView.DataKeyValues(intFirstChildRowIndex)("soptype")
End If