I have created a RadTreeView in a web page. it is displaying and working properly. However, I am trying to create a node and add it to the TreeView using the example found at http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/clientsideapi/defaultcs.aspx. When I do that, it is failing. The code I am using is:
When stepping through the above code, it gets to the node.set_text and throws an exception that says node is null or not an object. What am I doing wrong here?
function
addNode() {
treeView.trackChanges();
var
node =
new
Telerik.Web.UI.RadTreeNode();
node.set_text(FeatureNameText.get_value());
var
parent = treeView.get_selectedNode() || treeView;
parent.get_nodes().add(node);
if
(parent != treeView && !parent.get_expanded())
parent.set_expanded(
true
);
treeView.commitChanges();
return
false
;
}
When stepping through the above code, it gets to the node.set_text and throws an exception that says node is null or not an object. What am I doing wrong here?