Clientside, I use a contextmenu to offer functionality to the user to build up the TreeView. One of those functions is called "Add a Subnode". What happens basically when clicking that function is a postback to the server where I create a new XML node in my custom document, at the right position based on the parameters and then reload the TreeView by calling the recursive function. This works fine.
What I'd like to do is the following: after adding a new subnode, automatically put the new node in edit mode when the page reloads so that the user can immediately start typing. Is there an easy way to do this? What I've come up with so far is registering a StartupScript or ScriptBlock that calls the following javascript function:
function editInit(nodeValue){
var tree= $find("<%= RadTreeView1.ClientID %>");
var node = tree.findNodeByValue(nodeValue);
tree._startEdit(node);
}
This does not work because I get javascript errors saying used methods are not supported on findNodeByValue due to the RadTreeView not being fully loaded yet. However, when i combine calling the editInit function with a setTimeout function (100 milliseconds), so that it waits a few milliseconds before calling the function, it works perfectly. However, I don't like this approach, because I don't know how reliable it's going to be once it's deployed online and the tree grows in size.
Isn't there an easier way to do this? Can't I set a property of a RadTreeNode which puts the node in Edit mode, the same way the property "Selected" works?