Posted on May 11, 2011 (permalink)
<
telerik:RadTreeView
runat
=
"server"
ID
"RadTreeView1"
>
ContextMenus
telerik:RadTreeViewContextMenu
"menu1"
Items
telerik:RadMenuItem
Text
"MoveUp"
/>
"MoveDown"
"Send E-Mail"
</
"RadTreeViewContextMenu2"
"Edit"
"Copy"
"Delete"
Nodes
telerik:RadTreeNode
"People"
"Johny"
Value
"1"
ContextMenuID
"Jimmie"
"2"
"Donie"
"3"
asp:Button
"Button1"
"AddNode"
OnClientClick
"AddNode();"
<script type=
"text/javascript"
function
AddNode()
{
treeView = $find(
"<%= RadTreeView1.ClientID %>"
);
var
menuId = treeView.get_contextMenuIDs()[1];
//accessing the required contextMenu using index
treeView.trackChanges();
newNode =
new
Telerik.Web.UI.RadTreeNode();
newNode.set_text(
"abc"
newNode.set_value(
"123"
newNode.set_contextMenuID(menuId);
parent = treeView.get_selectedNode() || treeView;
parent.get_nodes().add(newNode);
if
(parent != treeView && !parent.get_expanded())
parent.set_expanded(
true
treeView.commitChanges();
}
</script>
Back to Top
UI controls for ASP.NET AJAX, MVC, WPF, Silverlight, Windows Forms and Windows Phone. Visual Studio productivity tools. Reporting and data layer solutions.
HTML5 / JavaScript tools for Web and Mobile applications
Functional, Performance, Load and Mobile Software Testing
CMS, Mobile Web, Ecommerce, Emarketing, Social Media
Project management software inspired by Agile best practices
It seems you haven't bookmarked any pages. Fix that by clicking the button below