This is a migrated thread and some comments may be shown as answers.

[Solved] Help for Treeview Control

3 Answers 96 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Krantikumar Jain
Top achievements
Rank 1
Krantikumar Jain asked on 17 Feb 2010, 08:01 PM

Hi,
I am using Treeview control to create Folder and file structure functionality. I have added context Menu to show New Folder option while right clicking on the Node item. I want to disable the New Folder for the file level. 
case "NewFolder":

 

 

if (treeNode.get_parent() == treeNode.get_treeView())

 

{

menuItem.set_enabled(

true);

 

}

 

else

 

 

 

{

 

menuItem.set_enabled(

true);

 

}

 

break;

Thanks,
Krantikumar Jain

 

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 18 Feb 2010, 12:24 PM
Hello Krantikumar Jain,

In your example the files are the leafs of the tree (e.g. they have no nodes in their collection). So one possible solution is to use :

var node = eventArgs.get_node(); //gets the node
if (node.get_nodes().get_count() == 0) //e.g. the current node is a leaf
{
   menuItem.set_enabled(false);
}
else
{
   menuItem,set_enabled(true);
}

If you have further questions dont hesitate but please next time attach the full code so I can inspect it carefully.

Please let me know if this was helpful.

Best wishes,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Krantikumar Jain
Top achievements
Rank 1
answered on 18 Feb 2010, 01:36 PM
Hi,
Thanks for your help.
I am adding different nodes to the Treeview Control and I want to show different Image for the Newly added Node can you please let me know how it can be done.

RadTreeView1.SelectedNode.Nodes.Add(newNode)

I want to add different image URL for the newNoode.

thanks,
Krantikumar Jain

0
Veronica
Telerik team
answered on 18 Feb 2010, 03:44 PM
Hi Krantikumar Jain,

To add a new Image Url just use the ImageUrl property of the RadTreeNode. Check the attached .zip file for an example solution.

Best wishes,
Veronica Milcheva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Krantikumar Jain
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Krantikumar Jain
Top achievements
Rank 1
Share this question
or