Welcome Guest Search | Active Topics | Sign In | Register

Add nodes to Treeview with client script Options
swk
Posted: Tuesday, October 13, 2009 11:13:39 AM
Rank: Newbie
Groups: Member

Joined: 9/29/2009
Posts: 3
Is there a way to add tree nodes with client side javascript?

thanks
eo_support
Posted: Tuesday, October 13, 2009 11:21:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

No. You will not be able to do that. You can do the following though:

1. Create TreeNode on the server side but set them as invisible. You can then use client side JavaScript to turn them visible. This way you can make it look as if you are adding TreeNode on the client side, however because all the invisible items are pre-created on the server side, so the total number of nodes can be "added" are limited by the total number of tree node you created;

2. Use PopulateOnDemand to dynamically create TreeNode. This allows you to create any number of TreeNode anywhere and the process can be triggered from client side JavaScript code. However you can only populate each tree node once. So if you have already populated TreeNode X with child node A, B and C, there would be no way for you add another child node D.

3. Use a CallbackPanel together with the TreeView. The process can be triggered from client side JavaScript code and it will allow you to update the TreeView anyway you want. This is the easiest solution. Even though it is not as fast as a pure JavaScript solution, visually they will be close because only the TreeView is being updated and nothing else in the page is reloaded.

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.