We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Tree view - Load on demand from sql datasource

Thread ID:





103437 May 3,2012 09:12 AM UTC May 15,2012 07:01 AM UTC ASP.NET Web Forms (Classic) 7
Tags: Tools
Ross Macintyre
Asked On May 3, 2012 09:12 AM UTC


Does anyone have an example of how you would load on demand a child node using a datasource?

Thanks in advance


Varalakshmi R.S [Syncfusion]
Replied On May 4, 2012 06:19 AM UTC

Hi Ross,

Thanks for contacting Syncfusion forums.

You may refer the following online sample which clearly exhibits the behavior of LoadOnDemand in TreeView control,
ASP.NET MVC: http://mvc.syncfusion.com/sfmvcsamplebrowser/
ASP.NET: http://asp.syncfusion.com/demos/ui/tools/TreeView/LoadOnDemand/cs/LoadOnDemand.aspx


Ross Macintyre
Replied On May 10, 2012 04:20 PM UTC

    Thanks Varalakshmi, I have looked at the examples for ASP.net although the example shown is for a manually created node.

I am having trouble making the step between a databound tree and loading the child on demand

I could be completely going down the wrong path, although an example of what I am trying to do, which is take some of your example is below.

ANY help would be greatly appreciated.

Protected Sub TreeView1_NodeExpanded(sender As Object, e As Syncfusion.Web.UI.WebControls.Tools.TreeViewNodeEventArgs) Handles TreeView1.NodeExpanded


    End Sub

    Private Function BuildTree(nClientID As String) As TreeViewNode
        Dim dsGroup As New DataSet
 dsGroup = ReturnClientTree(sClient)

        Dim oTree As TreeView = New TreeView()
        oTree.DataSource = dsGroup
        oTree.DataMember = dsGroup.Tables(0).TableName

        Dim oTv As New TreeViewItemBinding
        oTv.DataMember = dsGroup.Tables(0).TableName
        oTv.ParentIDField = "PID"
        oTv.TextField = "MDESC"
        oTv.IDField = "MID"
        oTv.Expanded = True

        Return oTree.Items(0) 'ISSUE: this only returns the first node, but the theory works

    End Function

Varalakshmi R.S [Syncfusion]
Replied On May 11, 2012 07:25 AM UTC

Hi Ross,

Thanks for the update.

TreeView node should be returned from the BuildTree event for this requirement and you have used “oTree.Items(0)” which always returns first node of the TreeView. Can you please share a simple sample with us to see the exact issue. It would help us on analyzing your needs.



Ross Macintyre
Replied On May 11, 2012 11:16 AM UTC

Hi Varalakshmi

I have attached an example of what I am trying to do.

It would appear that it order for this to work, I have to add a dummy parent in order to see all the children as I can only return one node.

I have included a couple of screen shots of what it looks like on the live site so you can see what it would look like for the user. Ideally, after selecting the parent, all the children would appear directly under the parent, rather than an extra step down.

While I could manually build this by iterating through the dataset, it is not ideal from a performance point of view.

Hoping there is an easier way.




Varalakshmi R.S [Syncfusion]
Replied On May 14, 2012 06:20 AM UTC

Hi Ross,

Thanks for the sample.

We are not able to run the attached sample since database file is missing in this attachment. Can you please provide a complete sample application in order to see this issue?


Ross Macintyre
Replied On May 14, 2012 07:48 AM UTC

Hi Varalakshmi

You don't need my database for this example as you just need to point a sql instance. The queries used do not actually query any table, so currently the query just points to the master database/



Varalakshmi R.S [Syncfusion]
Replied On May 15, 2012 07:01 AM UTC

Hi Ross,

We regret for the inconvenience.

Currently we are not providing support for load on demand using database binding and this is already logged as feature requirement. This will be available in our ES volume 3,2012 release which is scheduled in the month of July. We will get back you once this feature is implemented.




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon