Hi All,
Current I have a Telerik:Grid which has NestedViewTemplate. Inside this NestedViewTemplate I have a DetailTables. Inside the DetailTables. I have Telerik:GridTableView. I have specified ParentTableRelation with DetailKeyFeild and MasterKeyFeild.
This GridTableView is binding data when I expand the row in MatserTable of main grid.
Problem: On code behind of OnNeedDataSource of Grid present in detail table, How to access the value of DataKeyName of main table. I have specified the same key as the MasterKeyFeild also.
To be precise, How to access MasterKeyFeild Value specified in the detail table in OnNeedDataSource. I hope this MasterKeyFeild Value would be obtained from MainGrid automatically.
Posting code for your comfort.
Current I have a Telerik:Grid which has NestedViewTemplate. Inside this NestedViewTemplate I have a DetailTables. Inside the DetailTables. I have Telerik:GridTableView. I have specified ParentTableRelation with DetailKeyFeild and MasterKeyFeild.
This GridTableView is binding data when I expand the row in MatserTable of main grid.
Problem: On code behind of OnNeedDataSource of Grid present in detail table, How to access the value of DataKeyName of main table. I have specified the same key as the MasterKeyFeild also.
To be precise, How to access MasterKeyFeild Value specified in the detail table in OnNeedDataSource. I hope this MasterKeyFeild Value would be obtained from MainGrid automatically.
Posting code for your comfort.
| <rad:radgrid id="UserGridRegular"> |
| <MasterTableView DataKeyNames="ID" DataKeyNames="ID"> |
| <NestedViewTemplate> |
| <Rad:RadGrid ID="nestedgrid" runat="server" OnNeedDataSource="UserGridRegular_NeedDataSource1"> |
| <MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="ServerBind" EnableNoRecordsTemplate="false" |
| DataKeyNames="ID,ParentID"> |
| <SelfHierarchySettings ParentKeyName="ParentID" KeyName="ID"></SelfHierarchySettings> |
| <DetailTables> |
| <Rad:GridTableView DataKeyNames="ID"> |
| <ParentTableRelation> |
| <Rad:GridRelationFields DetailKeyField="ID" MasterKeyField="ID" /> |
| </ParentTableRelation> |
| <Columns> |
| <Rad:GridTemplateColumn HeaderText="ID" |
| UniqueName="ID"> |
| <ItemTemplate> |
| <asp:Literal ID="Literal7" runat="server" Text='<%# Eval("ID") %>'></asp:Literal> |
| </ItemTemplate> |
| </Rad:GridTemplateColumn> |
| <Rad:GridTemplateColumn HeaderText="ParentID" |
| UniqueName="ParentID"> |
| <ItemTemplate> |
| <asp:Literal ID="Literal8" runat="server" Text='<%# Eval("ParentID") %>'></asp:Literal> |
| </ItemTemplate> |
| </Rad:GridTemplateColumn> |
| </Columns> |
| </Rad:GridTableView> |
| </DetailTables> |
| </MasterTableView> |
| </Rad:RadGrid> |
| </NestedViewTemplate> |
| <Columns> |
| <Rad:GridTemplateColumn HeaderText="ID" |
| UniqueName="ID"> |
| <ItemTemplate> |
| <asp:Literal ID="Literal2" runat="server" Text='<%# Eval("ID") %>'></asp:Literal> |
| </ItemTemplate> |
| </Rad:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </rad:radgrid> |