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>
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.
Hi NewbApps,
Thank you for your reply.
The DataKeyFields property of WHDG is not a ControlValuePropertyAttribute and therefore cannot be used in a control parameter. Please refer to the following article for more information on the subject of control parameters:
http://msdn.microsoft.com/en-us/library/ie/xt50s8kz.aspx
Using a control parameter in this case defeats the purpose of having a DataRelation defined in the WebHierarchicalDataSource. I suggest that you consider implementing a parameter-less select method for use in your child ObjectDataSource. The relation defined in the WebHierarchicalDataSource will take care of matching up the corresponding parent and child records.
Please let me know if this helps.
Hi Petar I gotIput String was in the correct format. How to set up control parameter of my WHDG to my childobjectdatasource. maybe im missing something.
<asp:ObjectDataSource ID="odsParent" runat="server"
SelectMethod="GetParent" TypeName="ClassLibrary1">
SelectMethod="getChildByParentId"
TypeName="ClassLibrary1">
<asp:ControlParameter ControlID="WebHierarchicalDataGrid1"
PropertyName="DataKeyFields" Name="ParentId"
Type="Int32"/>
WEB HDS:
DataSourceID="odsParent " />
<ig:DataView ID="odsChild_DefaultView" DataMember="DefaultView"
DataSourceID="odsChild" />
<datarelations>
<ig:DataRelation ChildColumns="ParentId"
ChildDataViewID="odsChild_DefaultView" ParentColumns="ParentId"
ParentDataViewID="odsParent_DefaultView" />
</datarelations>
Can you give sample app about this sir.
And also: how to enable rowbumbering of child band using manual on load demand?
Thanks in Regards
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.