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

Dynamically Expandable TreeView Nodes

Thread ID:





72982 Apr 14,2008 07:29 PM UTC Apr 24,2008 02:34 PM UTC ASP.NET Web Forms (Classic) 2
Tags: Tools
Asked On April 14, 2008 07:29 PM UTC

I have a TreeView with Nodes that are added in client-side code (I'm loading it with a list of drives/directories/files from the local file system). I want to dynamically load the contents of the directories dynamically, much like I've done with Server-side callback. However, if I select ExpandMode = TreeViewNodeExpandMode.ClientSide, the "+" doesn't appear next to the node. How can I get the "+" to appear in this case. Eventually, I want my ClientSideOnNodeExpand JScript function called when the user clicks on the "+"..

Replied On April 18, 2008 03:14 PM UTC

Ok, I found a workaround. Whenever I create a folder, I also create a dummy node under it with text of "". Then, when the user expands the folder, I check for a single node with the above text. If it exists, I delete it and load the contents of the directory into the tree. I used the angle brackets above since they are not valid in a filename.

It seems like there should be a better way to accomplish this; but, this will do for now.

Janagan [Syncfusion]
Replied On April 24, 2008 02:34 PM UTC

Hi Neal,

If your intention is to load the childnode dynamically by invoking the clientside javascript, it can be achieved via a callback panel but you cannot make the "+" sign to appear by setting the expandmode to client side because When the expand mode is set to Client side, any callback or postback will not occur on expanding node. Please refer the code below for dynamically loading the child node via callback panel:

function nodeExpand(node)

document.getElementById(''eventDisplay'').innerHTML = "Expanded ''" + node.Text + "''" ;

code behind:

protected void CallbackPanel1_CallbackRefresh(object sender, CancellableCallbackEventArgs e)
foreach (TreeViewNode node in this.TreeView1.Items)

if (node.Text == e.CallbackArgument)
TreeViewNode childnode = new TreeViewNode();
childnode.Text = "New Text";


Please refer the sample in the link below which illustrates the above:


Please try running the sample and if still the issue exists, could you please try reproducing it in the above sample so that we could sort out the cause and provide you a better solution?



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

or the page will be automatically redirected to 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