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

Force TreeViewAdv node to stay in edit mode

Thread ID:





38938 Dec 21,2005 04:09 PM UTC Dec 22,2005 02:31 PM UTC WinForms 2
Tags: Tools
Jon Zucker
Asked On December 21, 2005 04:09 PM UTC

How can I force a tree node to stay in edit mode? After I add a new node to a tree, I invoke TreeViewAdv.BeginEdit(MyNewNode) to force the user to type in a new name for the node. I also use the NodeEditorValidating event handler to ensure that the name is unique. My event handler looks like this: if (NewNameIsNotUnique(e.Label)) { MessageBox.Show(“Name is not unique”); TreeViewAdv.BeginEdit(e.Node); } What I’m trying to do is to leave the node in editing mode until the user enters a unique name. But instead, when the event handler exits, the node leaves editing mode. This can leave a non-unique node name (which is bad for me). The BeginEdit method doesn’t seem to have any effect. The node is no longer in edit mode when this function completes. If I invoke TreeViewAdv.EndEdit(false) before calling BeginEdit (or instead of calling BeginEdit), then the NodeEditorValidating function is reinvoked in an infinite loop. Any ideas on how to keep the user from leaving a node that’s in edit mode until they’ve entered a valid (in my case, that means unique) node name?

Deepa TS [Syncfusion]
Replied On December 22, 2005 09:30 AM UTC

Hi Jzucker, Please refer to the sample attached with this, that shows how you could accomplish the above by handling the TreeViewAdv''s NodeEditorValidating eventas shown below : private void treeViewAdv1_NodeEditorValidating_1(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvCancelableEditEventArgs e) { if(e.Label=="Syncfusion") { e.Cancel = false; MessageBox.Show("Unique"); e.ContinueEditing = false; } else { // Cancel the label edit action, inform the user, and place the node in edit mode again. // e.Cancel = true; MessageBox.Show("Name is not unique"); // To end editing mode, do this: e.ContinueEditing = true; } } Let me know if this meets your requirements. Thanks for your continued interest in Syncfusion products. Regards, Deepa.T.S


Jon Zucker
Replied On December 22, 2005 02:31 PM UTC

Well, it sort of works. When I run the sample code in the sample project you provided, it works perfectly. But when I use the same code in my own project, I still get stuck in an infinite loop. The tree''s NodeEditorValidating event is fired again after I exit the event handler, but I don''t know why. I''m still looking into that. Thanks for your help.


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

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