Could someone please help me with the correct code to reference the DataKeyValue in the Child item of a Hierarchy using ItemInserted. I have tried the following code but don't get the datakey returned at the Child ("Sheds") level.
Thanks
Protected Sub RadGrid1_ItemInserted(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles RadGrid1.ItemInserted
If e.Exception Is Nothing Then
Dim editedItem As GridEditableItem = e.Item
If "Placements".Equals(editedItem.OwnerTableView.Name) Then
Dim gridRows As GridItemCollection = RadGrid1.Items
Dim id As Int32 = 0
For Each data As GridDataItem In gridRows
id = Math.Max(id, data.GetDataKeyValue("PlanMasterId"))
Next
UpdateFarmPerformance(id)
ElseIf "Sheds".Equals(editedItem.OwnerTableView.Name) Then
'Update the Placment details from the shed details
Dim parentItem As GridDataItem = editedItem.OwnerTableView.ParentItem
Dim id As Int32 = parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("PlanMasterId")
updatePlacements(id)
Dim gridRows As GridItemCollection = e.Item.OwnerTableView.Items
Dim id2 As Int32 = 0
For Each data As GridDataItem In gridRows
id2 = Math.Max(id2, data.GetDataKeyValue("PlanMasterShedId"))
Next
UpdateShedPerformance(id2)
UpdateFarmPerformance(id)
End If
End If
End Sub