I have 3 level nested detail table herarchy like a Locations has multiple branches and each branches has multiple devices.
Now my aspx looks like below.
<telerik:RadGrid ID="grdLocations" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" AutoGenerateDeleteColumn="True"
AutoGenerateEditColumn="True" DataSourceID="LinqDataSourceLocations" GridLines="None"
Skin="Gray">
<MasterTableView DataSourceID="LinqDataSourceLocations" DataKeyNames="LocationID">
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="LinqDataSourceBranches" DataKeyNames="BranchID">
<ParentTableRelation>
<telerik:GridRelationFields MasterKeyField="LocationID" DetailKeyField="LocationID" />
</ParentTableRelation>
<DetailTables>
<telerik:GridTableView runat="server" DataSourceID="LinqDataSourceDevices">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="BranchID" MasterKeyField="BranchID" />
</ParentTableRelation>
</telerik:GridTableView>
</DetailTables>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
<asp:LinqDataSource ID="LinqDataSourceLocations" runat="server" ContextTypeName="InsightDataContext"
Select="new (LocationName, LocationID)" TableName="LocationMasters">
</asp:LinqDataSource>
<asp:LinqDataSource ID="LinqDataSourceBranches" runat="server" ContextTypeName="InsightDataContext"
Select="new (BranchID, BranchName, LocationID)" TableName="BranchMasters" Where="LocationID == @LocationID">
<WhereParameters>
<asp:ControlParameter ControlID="grdLocations" Name="LocationID" PropertyName="SelectedValue"
Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<asp:LinqDataSource ID="LinqDataSourceDevices" runat="server" ContextTypeName="InsightDataContext"
Select="new (DeviceName, DeviceID, BranchID)" TableName="DeviceMasters" Where="DeviceID == @DeviceID">
<WhereParameters>
<asp:Parameter Name="DeviceID" Type="Int32" />
<%--<asp:ControlParameter Name="DeviceID" PropertyName="SelectedValue"
Type="Int32" />--%>
</WhereParameters>
</asp:LinqDataSource>
Here you can see I have placed 3 LinqDataSources for three tables. Now thing is I could write WHERE parameter for my branches table as I could got grdLocations and which has DataKeys as LocationID. But I could not get its detail table's DataKey value i.e. BranchID for my last LinqDataSource (Inner detail table's datasource control could not get its parent's ID).
What should I do in this?
Thanks & Regards,
Divyesh Chapaneri