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

Server side event when creating new node via context menu

5 Answers 62 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 09 Nov 2009, 09:25 PM
I have a treeview and a context menu based on the examples on this website, with some added functionality.

When right clicking on a node and adding a new node, the node is put into edit mode. If I change the name of the newly created node (I set a default value in code behind), the NodeEdit server side event fires, which is what I want.

However, if I do not change the name, the server side event does not fire. This is likely by design. However, in the case where I am creating new nodes, I need that server event to fire anyway.

Is there a way to do this?

Greg

5 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 12 Nov 2009, 03:27 PM
Hi Greg,

There is no good and clean method of doing this.
If you wish to override some private methods of the treeview you might achieve that but it is not the recommended approach.

Sincerely yours,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Greg
Top achievements
Rank 1
answered on 12 Nov 2009, 04:38 PM
It would be nice to see this as a feature in a future release.

Thanks.
0
Martin
Top achievements
Rank 1
answered on 11 Jan 2013, 09:09 AM
I have the same issues. So which is the recommended approach? This should be a rather common approach? It seems to work as I want in Outlook Web Access 2010 when adding a new folder to my mailbox.

I donĀ“t want to use plan client-side since I always rely on each node having a Value corresponding to the items database id. WHen using regular server side I guess I cannot set the node in edit mode from server side.
Thanks

Martin
0
Bozhidar
Telerik team
answered on 15 Jan 2013, 09:57 AM
Hi Martin,

I've prepared a small sample page using the RadTreeView ContextMenu demo as a reference, which has the desired functionality. The only change I made, other than stripping the page from the unneeded code, is the addition of the following two lines in the startNodeInEditMode method:
js += "node._originalText = \"\";";
js += "node._originalTextHtml = \"\";";

You can find the page attached to this reply.
 

Greetings,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin
Top achievements
Rank 1
answered on 15 Jan 2013, 10:52 AM
Many thanks!
Tags
TreeView
Asked by
Greg
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Greg
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or