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. Image for the cookie policy date

TreeViewAdv Conditional Display

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

3 Replies

VS Vijayanand S Syncfusion Team September 19, 2005 04:44 AM UTC

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


VI Vinay September 19, 2005 01:18 PM UTC

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


VS Vijayanand S Syncfusion Team September 19, 2005 03:00 PM UTC

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.

Loader.
Live Chat Icon For mobile
Up arrow icon