Hi,
I am trying to nest a grid within a grid.
To populate the most inner grid i need the KeyValue from both the Grids' direct parent, and the parent of the Grids' parent.
How can i retrieve the MasterRowKeyValue from the outter most parent?
I have 3 grids nested like so:
<dxwgv:ASPxGridView ID="gridParents" runat="server" ObjectDataSource="odsParents" KeyFieldName="ParentId">
<SettingsDetail ShowDetailRow="true" />
<Columns>
<dx:GridViewDataColumn FieldName="ParentIdId" Visible="false" />
<dx:GridViewDataColumn FieldName="Title" />
</Columns>
<Templates>
<DetailRow>
<dxwgv:ASPxGridView ID="gridParentsChilren" runat="server" ObjectDataSource="odsParentsChildren" KeyFieldName="ChildId" OnBeforePerformDataSelect="gridParentsChilren_DataSelect">
<SettingsDetail ShowDetailRow="true" IsDetailGrid="true" />
<Columns>
<dx:GridViewDataColumn FieldName="ChildId" Visible="false" />
<dx:GridViewDataColumn FieldName="Title" />
</Columns>
<Templates>
<dxwgv:ASPxGridView ID="gridParentsChilrenRoles" runat="server" ObjectDataSource="odsParentsChildrenRoles" KeyFieldName="RoleId" OnBeforePerformDataSelect="gridParentsChilrenRoles_DataSelect">
<SettingsDetail ShowDetailRow="true" IsDetailGrid="true" />
<Columns>
<dx:GridViewDataColumn FieldName="RoleId" Visible="false" />
<dx:GridViewDataColumn FieldName="Title" />
</Columns>
</dxwgv:ASPxGridView>
</Templates>
</dxwgv:ASPxGridView>
</DetailRow>
</Templates>
</dxwgv:ASPxGridView>
<asp:ObjectDataSource id="odsParents" runat="server" SelectMethod="GetParents" />
<asp:ObjectDataSource id="odsParentsChildren" runat="server" SelectMethod="GetParentsChildren">
<SelectParameters>
<asp:Parameter Name="parentid" Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource id="odsParentsChildrenRoles" runat="server" SelectMethod="GetParentsRoles">
<SelectParameters>
<asp:Parameter Name="childid" Type="Object" />
<asp:Parameter Name="parentid" Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>
When the OnBeforePerformDataSelect is called for the first Detail grid, i set the select parameters DefaultValue like this:
odsParentsChildren.SelectParameters["parentid"].DefaultValue = ((ASPxGridView)sender).GetMasterRowKeyValue().ToString();
For the most inner (the second) nested grid, i need to set one of my parameters to the MasterRowKeyValue of the most outter grid.
Something like:
odsParentsChildrenRoles.SelectParameters["childid"].DefaultValue = ((ASPxGridView)sender).GetMasterRowKeyValue().ToString();
odsParentsChildrenRoles.SelectParameters["parentid"].DefaultValue = ((ASPxGridView)sender).Master.GetMasterRowKeyValue().ToString();
How do I achieve this?