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.
Unfortunately, activation email could not send to your email. Please try again.

TreeViewAdv Conditional Display

Thread ID:

Created:

Updated:

Platform:

Replies:

34742 Sep 15,2005 05:22 AM Sep 19,2005 11:00 AM Windows Forms 3
loading
Tags: Tools
Vinay
Asked On September 15, 2005 05:22 AM

Hi All, I have a requirement as below. In my treeview I need to display data in hierarcy way, This display needs to be changed based on the user profile. ie for a particular user all nodes should be in one color , in other case a user will have read access to some and read / write for some. Can any one suggest me in this regard Thanks Vinay

Vijayanand S [Syncfusion]
Replied On September 19, 2005 12:44 AM

Hi Vinay, Sorry for the delayed response. You could manage the TreeViewAdv node''s read / write property by cancelling the BeforeEdit event for particular nodes and for particular users. Please take a look at the following code snippet and the attached test sample. private void treeViewAdv1_BeforeEdit(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs e) { if(username=="user1") { if ((e.Node.Text == "Node0") || (e.Node.Text == "Node5")||(e.Node.Text == "Node3")||(e.Node.Text == "Node8")) { e.Cancel = true; } } else if(username=="user2") if ((e.Node.Text == "Node2") || (e.Node.Text == "Node4")||(e.Node.Text == "Node6")||(e.Node.Text == "Node10")) { e.Cancel = true; } } Steps to view this test sample: 1. Run the test sample. 2. In the Login menu, choose any user. 3. You will notice that color will be changed for some nodes. 4. Try to edit those colored nodes. 5. Again choose another user from the Login menu. 6. Color will be changed for other different nodes. 7. Try to edit those colored nodes. Please let me know if you have any questions. Thanks for your patience. Regards, Vijay

Vinay
Replied On September 19, 2005 09:18 AM

Hi Vijay, This code helps me to some extent. My exact need will be to disable clicks (left & Right ) on some selected nodes. Further is there any posibility to have a different node image for all disbled treeview nodes. Thanks Vinay

Vijayanand S [Syncfusion]
Replied On September 19, 2005 11:00 AM

Hi Vinay, You could set the enabled property to false for the particular node you want to set as ReadOnly property. As well as you could set the LeftImage property for particular nodes by node=this.treeViewAdv1.Nodes[6]; node.LeftImageIndices=new int[] {5}; Please take a look at this test sample and let me know if you have any questions. We appreciate your interest in Syncfusion Products. Thanks, Vijay.

CONFIRMATION

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.

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.

;