This is a migrated thread and some comments may be shown as answers.

Get all RadDocks in RadDockZone in Codebehind

1 Answer 68 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 30 Jul 2013, 05:16 PM
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

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 02 Aug 2013, 01:37 PM
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.
Tags
Dock
Asked by
Michael
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or