After a successful insert I would like the new record to go into edit/update mode. The reason is the update template contains a section that exist only if there is a parent record. So after inserting the parent record exist now I can allow inserting of child records.
You can refer the CodeLibrary Select Last Inserted Row to select the last inserted row. Apply the same logic, but instead of selecting the row set the row in edit mode.
That linked really set me on the right track. Here is my entire grid_prerender code. Hope this helps others. This is has two parts. The first is the parent which after inserting a new record will automatically expand to the details. When a new details is inserted, it will keep the parent expanded while switching to edit mode.
Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
' Do nothing if RadGrid is in insert mode or no new item is inserted recently.
If RadGrid1.MasterTableView.IsItemInserted OrElse _RequestID <= 0 And _AnnualRequestID <= 0 Then
Return
End If
Dim _ARID As Integer = 0
If _AnnualRequestID > 0 Then
For Each items As GridDataItem In RadGrid1.Items
If items.OwnerTableView.Name = "parentgrid" Then
If _AnnualRequestID.Equals(Convert.ToInt32(items("AnnualRequestID").Text)) Then
items.Expanded = True
' flag exit
Exit For
End If
End If
Next
Exit Sub
End If
If _RequestID > 0 Then
For Each items As GridDataItem In RadGrid1.Items
If items.OwnerTableView.Name = "parentgrid" Then
If _ARID > 0 Then
If _ARID.Equals(Convert.ToInt32(items("AnnualRequestID").Text)) Then
items.Expanded = True
' flag exit
Exit For
End If
End If
End If
If items.OwnerTableView.Name = "Prioritization" Then
If _RequestID.Equals(Convert.ToInt32(items("PrioritizationID").Text)) Then