Get all RadDocks in RadDockZone in Codebehind

2 posts, 0 answers
  1. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 30 Jul 2013 Link to this post

    I have a series of dynamically created raddocks, that are dynamically placed in different RadDock zones. If the user presses "Save" I am trying to cycle through each raddockzone and then save information from them in a database. See below.

    private void SaveWorkspacePanels(RadDockZone dockzone,int workspaceid,int panellocation)
        {
            try
            {
                BusinessLayer BL=new BusinessLayer();
                DemandSolutions_WorkspacePanel WorkspacePanel;
                string source;
                string [] parsed;
                string panelid;
                string paneltype;
                foreach(RadDock dock in dockzone.Docks)
                {
                    WorkspacePanel=new DemandSolutions_WorkspacePanel();
                    source=dock.Tag;
                    parsed=source.Split(' ');
                    panelid=parsed[0];
                    paneltype=parsed[1];
                    WorkspacePanel.PanelID=Convert.ToInt32(panelid);
                    WorkspacePanel.PanelLocation=panellocation;
                    WorkspacePanel.WorkspaceID=workspaceid;
                    BL.InsertWorkspacePanel(WorkspacePanel);
                }//End For-Each
            }
            catch(Exception ex)
            {
                DisplayMessage.InnerText="Problem with "+dockzone.ID+" "+ex.ToString();
            }
     
        }//End Function

    The problem is if the RadDock is moved from another dockzone, it is not detected and therefor not saved...any thoughts.

    Here is how the RadDock is created

    RadDock dock=new RadDock();
    dock.DockMode = DockMode.Docked;
    dock.ID= string.Format("RadDock{0}", Guid.NewGuid().ToString().Replace('-', 'a'));
    dock.Tag=panelID+" "+controlType;
    dock.Title=panelTitle;
    dock.Text=panelDescription;
    dock.Width=Unit.Percentage(100);
    dock.AutoPostBack=true;
    dock.Commands.Add(new DockExpandCollapseCommand());




    Michael
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 02 Aug 2013 Link to this post

    Hi Michael,

    It is possible that you are saving the information before the Docks collection of RadDockZone is updated after the RadDock is dragged. Please check this helps article. The dock state is ready to be saved anywhere after Page.Load so I would suggest executing your logic after this event, preferably on RadDockLayout.SaveDockLayout, which is designed for this purpose.

    If you are saving the information from the docks in order to persists their layout, you can use the approach shown in this online demo.

    In case you are still having difficulties after examining the information above, please open a support ticket and send a simple, fully runnable project that isolates your logic so that I can inspect it locally and provide a more to the point answer.

    Regards,
    Slav
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top