This is a migrated thread and some comments may be shown as answers.

Detail Record EditTemplate

1 Answer 30 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
David asked on 09 Oct 2014, 06:08 PM
I have a hierachial grid with a master grid (grdAircraftMasterView) and two nested detail views (tblCrew, tblGear).
   Edit Form Settings are set to Template in all three views. 

in tblCrew's edit template is a button with a command name of "SignUp" and command arguments of:  DataBinder Eval(Container, "ItemIndex"
When this button is clicked the program jumps to the grids item command and processed through the 'SignUp' portion.
However e.Item is GridDataItem and e.Item.IsInEditMode = false. I cannot reference the editform template.FindControl to get the user input. Additionally, the tblCrew row does not move out of edit mode and the edit template form remains open.

item.EditFormItem.IsInEditMode is true

How do I reference the detail views editformtemplate, retreive the user input from a control, and then set the detail rows IsInEditMode to false?

Thanks in advance



<telerik:RadGrid ID="rgdAircraft" runat="server" AllowSorting="false" GridLines="Both" AutoGenerateColumns="false"
     OnItemCommand="rgdAircraft_ItemCommand" OnNeedDataSource="rgdAircraft_NeedDataSource" Skin="Web20"
     AllowMultiRowSelection="false" OnPreRender="rgdAircraft_PreRender" OnDetailTableDataBind="rgdAircraft_DetailTableDataBind" OnItemDataBound="rgdAircraft_ItemDataBound">
     <MasterTableView EnableHierarchyExpandAll="true" DataKeyNames="strFlightId" runat="server" CommandItemDisplay="Bottom" EditFormSettings-EditFormType="Template" CommandItemSettings-AddNewRecordText="Add new Aircraft" HierarchyLoadMode="Client" EditMode="PopUp" Name="grdAircraftMasterView">
             <telerik:GridTableView AutoGenerateColumns="false" TableLayout="Auto" DataKeyNames="strFlightId" Name="tblCrew" ShowFooter="false" Caption="Aircrew" Width="100%"  CommandItemDisplay="Bottom" EditMode="PopUp" CommandItemSettings-AddNewRecordText="Add new position">
                 <EditFormSettings EditFormType="Template">
                     <EditColumn UniqueName="intMissionCrew" />

Already looked at the demo at, however this demo does not address controls within the edit template.


1 Answer, 1 is accepted

Sort by
Konstantin Dikov
Telerik team
answered on 14 Oct 2014, 04:25 PM
Hello David,

For getting reference to controls within the edit FormTemplate you will have use the EditFormCell available in the GridEditFormItem:
if(e.Item is GridDataItem)
    //find the edit form item 
    GridEditFormItem formItem = (e.Item as GridDataItem).EditFormItem as GridEditFormItem;
    //get the cell which wraps the controls inside the edit form
    TableCell cell = formItem.EditFormCell as TableCell;
if (e.Item is GridEditableItem)
    //cast the item to GridEditFormItem
    GridEditFormItem formItem = e.Item as GridEditFormItem;
    //reference its parent data item
    GridDataItem dataItem = formItem.ParentItem as GridDataItem;

Detailed information on EditForms edit mode is available in the following help article:
As for closing the edit form for an item, what you need to do is to set the GridDataItem Edit property to false (and rebind the grid if you are setting it too late in the page's life cycle).

Hope this helps.

Konstantin Dikov

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Asked by
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question