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

RadGrid Parent/Child and ObjectDataSource

0 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Leszek
Top achievements
Rank 1
Leszek asked on 13 Sep 2017, 07:43 PM

Hi,

I have a typical master/child RadGrid:

<telerik:RadGrid ID="RadGridParent"
    AutoGenerateColumns="false"
    DataSourceID="ObjectDataSourceParent"
    runat="server">
    <MasterTableView
        DataSourceID="ObjectDataSourceParent"
        DataKeyNames="Id"
        Name="ParentGrid"
        CommandItemDisplay="Top"
        HierarchyDefaultExpanded="true"
        EnableHierarchyExpandAll="true"
        ShowFooter="false">
        <CommandItemSettings ShowAddNewRecordButton="false" />
        <DetailTables>
            <telerik:GridTableView
                DataSourceID="ObjectDataSourceChild"
                DataKeyNames="Id"
                Name="ChildGrid"
                CommandItemDisplay="Top"
                EditMode="InPlace"
                ShowFooter="false"
                HierarchyDefaultExpanded="true"
                runat="server">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ParentId" MasterKeyField="Id"></telerik:GridRelationFields>
                </ParentTableRelation>
                <Columns>
                ...
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>
<asp:ObjectDataSource ID="ObjectDataSourceParent" runat="server"
    SelectMethod="RetrieveList">
    <SelectParameters>
        <asp:QueryStringParameter Name="Id" querystringfield="id" />
    </SelectParameters>           
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSourceChild" runat="server"
    SelectMethod="RetrieveList">
    <SelectParameters>
        <asp:Parameter Name="parentId" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>

 

The problem is with the following line:

<asp:Parameter Name="parentId" Type="Int32" />

I'd like to specify the parentId of the corresponding parent record. How can I do that?

 

Thanks,

Leszek

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Leszek
Top achievements
Rank 1
Share this question
or