Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
How to Link Objectdatasource to WebheirarchicalDataSource
posted

Hi  i have webheirarchical datagrid which datasource will come from an objectdatasource.

Now i have problem on linking this two:

PARENT:

  <asp:ObjectDataSource ID="odsPatent" runat="server" 

        SelectMethod="GetParent" TypeName="ClassLibrary1.Class1">

    </asp:ObjectDataSource>

 

CHILD:

  <asp:ObjectDataSource ID="odsChild" runat="server" 

        SelectMethod="GetChild" TypeName="ClassLibrary1.Class1">

 <SelectParameters>

              <asp:ControlParameter ControlID="WebHierarchicalDataGrid1" DefaultValue="0" 

                  Name="ParentId" PropertyName="ParentId" Type="Int32" />

          </SelectParameters>

    </asp:ObjectDataSource>

WebHierarchicalDataSource:

 <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">

        <DataViews>

            <ig:DataView ID="odsParent_DefaultView" DataMember="DefaultView" 

                DataSourceID="odsParent" />

        </DataViews>

    </ig:WebHierarchicalDataSource>

 

where WebHierarchicalDataSource cant link the two datasources. 

Parents
No Data
Reply
  • 49378
    posted

    Hi NewbApps,

    Thank you for posting in the community.

    You should be able to specify both your parent and child ObjectDataSources as DataViews in a WebHierarchicalDataSource. Afterwards you need to define the relation between them. For instance:

            <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">
                <dataviews>
                    <ig:DataView ID="parentObjectDataSource_DefaultView" DataMember="DefaultView"
                        DataSourceID="categoryObjectDataSource" />
                    <ig:DataView ID="childObjectDataSource_DefaultView"
                        DataMember="DefaultView" DataSourceID="categoryObjectDataSource0" />
                </dataviews>
                <datarelations>
                    <ig:DataRelation ChildColumns="Id"
                        ChildDataViewID="childObjectDataSource_DefaultView" ParentColumns="Id"
                        ParentDataViewID="parentObjectDataSource_DefaultView" />
                </datarelations>
            </ig:WebHierarchicalDataSource>

    Please tell me if this helps.

Children