Beispiel #1
0
        protected void RadTreeView_WebSite_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e)
        {
            RadTreeNode             sourceNode   = e.SourceDragNode;
            RadTreeNode             destNode     = e.DestDragNode;
            RadTreeViewDropPosition dropPosition = e.DropPosition;

            if (destNode != null) //drag&drop is performed between trees
            {
                if (sourceNode.TreeView.SelectedNodes.Count <= 1)
                {
                    PerformDragAndDrop(dropPosition, sourceNode, destNode);
                }
                else if (sourceNode.TreeView.SelectedNodes.Count > 1)
                {
                    foreach (RadTreeNode node in sourceNode.TreeView.SelectedNodes)
                    {
                        PerformDragAndDrop(dropPosition, node, destNode);
                    }
                }

                destNode.Expanded = true;
                //sourceNode.TreeView.ClearSelectedNodes();
                sourceNode.TreeView.UnselectAllNodes();
            }
        }
Beispiel #2
0
    protected void RadTreeView_Toolbox_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e)
    {
        RadTreeNode sourceNode = e.SourceDragNode;

        if (e.HtmlElementID != null)
        {
            PlaceHolder   myPlaceHolder = (PlaceHolder)Page.Master.FindControl("PlaceHolder_DesignMode");
            HtmlInputText _currentPlaceholderPosition = (HtmlInputText)myPlaceHolder.FindControl("currentPlaceholderPosition");
            HtmlInputText _currentZoneTB = (HtmlInputText)myPlaceHolder.FindControl("currentZoneTB");

            int dockCurrentPos = int.Parse(_currentPlaceholderPosition.Value);

            MasterPageEditorMgr myMasterPageEditorMgr = new MasterPageEditorMgr();

            RadDockLayout myDockLayout = (RadDockLayout)this.Page.Master.FindControl("RadDockLayout_DesignMode");

            RadDock myDock = myMasterPageEditorMgr.Add_DesignMode_NewControl(this.Page, myMasterPage_Lock, sourceNode, _currentZoneTB.Value, dockCurrentPos);

            myDockLayout.Controls.Add(myDock);

            ScriptManager.RegisterStartupScript(
                myDock,
                this.GetType(),
                "AddDock",
                string.Format(@"function _addDock() {{  
            Sys.Application.remove_load(_addDock);  
            $find('{1}').dock($find('{0}'),{2});   
            $find('{0}').doPostBack('DockPositionChanged');   
            }};  
            Sys.Application.add_load(_addDock);", myDock.ClientID, _currentZoneTB.Value, dockCurrentPos),
                true);

            CreateSaveStateTrigger(myDock);
        }
    }