WebDataTree with enabled load-on-demand does not work with WebhierarchyDataSource with Self-Related Data Relation.
Is it bug or feature?
Vladimir
Hi Nikola
I am having the issue with the same i get the data using stored proc and then i want to bind the data ondemand in the codebehind but that is failing.
Can you please point me to the right direction
Regards
Raghu
Thanks Nikola
That works
Another question - how can I change images (+, -) in codebehind?
Thanks,
Sure, here it is:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Me.Page.IsPostBack Then
SetupDataSource()
Dim view As DataView view = New DataView view.ID = "DefailtView" view.DataSourceID = Me.AccessDataSource1.ID view.DataMember = "DefailtView" Me.WebHierarchicalDataSource1.DataViews.Add(view)
Dim relation As DataRelation relation = New DataRelation
relation.ChildColumns = New String() {"ParentCode"} relation.ChildDataViewID = view.ID relation.ParentColumns = New String() {"Code"} relation.ParentDataViewID = view.ID
Me.WebHierarchicalDataSource1.DataRelations.Add(relation) Me.WebDataTree1.InitialDataBindDepth = 0 Me.WebDataTree1.DataLoadingMessage = "Loading from table ..." Me.WebDataTree1.DataSourceID = Me.WebHierarchicalDataSource1.ID End If End Sub
Protected Sub WebDataTree1_NodePopulate(ByVal sender As Object, ByVal e As Infragistics.Web.UI.NavigationControls.DataTreeNodeEventArgs) Handles WebDataTree1.NodePopulate SetupDataSource() End Sub
Private Sub SetupDataSource() Me.AccessDataSource1.DataFile = "~/App_Data/TreeData.mdb" Me.AccessDataSource1.SelectCommand = "SELECT [Code], [TextValue], [ParentCode] FROM [Data]"
Dim binding As DataTreeNodeBinding binding = New DataTreeNodeBinding binding.DataMember = "DefailtView" binding.TextField = "TextValue" binding.ValueField = "Code" Me.WebDataTree1.DataBindings.Add(binding) End Sub
Hope that helps!
could you prived the final codebehind code?
Hi Vladimir,
when using the code-behind you should also bind the tree on the NodePopulate event.