Add a Node in edit mode by Default

2 posts, 0 answers
  1. mike
    mike avatar
    14 posts
    Member since:
    Feb 2009

    Posted 05 Aug 2009 Link to this post

    Implemented following example at this url http://www.telerik.com/help/aspnet-ajax/general-add-node-in-edit-mode-by-default.html
    cannot get to work after triying various combinations. I dont get any errors however the 3rd alert is not fired see code below. Works if i dont have an ajax panel.

    Can node.startEdit() be done server side would easier.

     

    protected void ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
    {
        RadTreeNode node = new RadTreeNode("NEW FOLDER", "1");
        ClickedNode.Nodes.Add(node);

        node.Selected = true;
        node.ExpandParentNodes();
        string script = "HighlightNode(\"" + node.Value + "\")";
        RadAjaxManager1.ResponseScripts.Add(script);
    }

    <telerik:RadScriptManager ID="RadScriptManager" runat="server" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
           <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"/>
           
            <telerik:RadScriptBlock ID="rsb" runat="server">
          
            <script type="text/javascript">
              function HighlightNode(value)
              {
                  alert(value);
                  var tree = document.getElementById("<%= tvLibraryTree.ClientID %>");
                  //  tired $find no luck unless no ajax panel
                  alert(tree);
                  alert(tree.findNodeByValue(value));
                  var node = tree.findNodeByValue(value);
                  if (node != null) node.startEdit();
              }
          </script>
       
        ......

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 05 Aug 2009 Link to this post

    Hello mike,

    You do not have to have RadAjaxPanel and RadAjaxManager on one page - you can use only the manager to ajaxify your controls.

    You can check a working demo here. Just right click a node and select New Folder.

    All the best,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top