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

Dynamically generating zones and docks

5 Answers 80 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Adrian
Top achievements
Rank 1
Adrian asked on 06 May 2009, 11:12 PM
Hi there,

Has anyone got any examples of dynamically adding/removing zones and docks which are persisted on postback. There are many examples showing docks only but nothing on zones. I basically need to create something similar to this example

http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx

but with the addition of being able to dynamically add or remove zones.

Many thanks

Ady



5 Answers, 1 is accepted

Sort by
0
Adrian
Top achievements
Rank 1
answered on 07 May 2009, 10:25 AM
I think ive got it sorted now actually. I needed to convert the ReadOnlyCollection of registered zones into a generic list

List<RadDockZone> zones = new List<RadDockZone>(RadDockLayout1.RegisteredZones); 

and i could then follow the example of dyanamically adding docks.

Ady
0
Adrian
Top achievements
Rank 1
answered on 07 May 2009, 10:59 AM
.
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 11 May 2009, 10:37 AM

List

 

<RadDockZone> zones = new List<RadDockZone>(RadDockLayout1.RegisteredZones);

 

 

foreach (RadDockZone zone in zones)

 

{

 

    string currentZoneID = zone.ID;

 

}



The RadDock control doesn't have a mechanism for the state of the RadDockZones, so you should create your own mechanism for preserving the state of the dynamically created RadDockZones.
The code below is related to the RadDocks state:

 

List<DockState> CurrentDockStates = RadDockLayout1.GetRegisteredDocksState();

 

 

..........

 

foreach

 

(DockState state in CurrentDockStates)

 

{

   string parentZoneID = state.DockZoneID;

}
....

0
Adrian
Top achievements
Rank 1
answered on 11 May 2009, 04:11 PM
Whats the best way to programatically remove dockzones ? 
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 12 May 2009, 02:40 PM
If you want to remove dynamically created RadDockZones, all you need to do is not to recreate them on postback.
The real problem is when a RadDock is in a RadDockZone which is already "removed". You could handle RadDock.OnClientInitialize event and dock a RadDock to the first zone if its parent zone is no longer on the page,e.g.
  function DockInitialize(dockObj,args) {  
                //Dock current RadDock to the firstZone  
        if(dockObj.get_dockZoneID() == "")  
        {  
            Telerik.Web.UI.RadDockZonesGlobalArray[0].dock(dockObj);  
        }  
    } 
Tags
Dock
Asked by
Adrian
Top achievements
Rank 1
Answers by
Adrian
Top achievements
Rank 1
Obi-Wan Kenobi
Top achievements
Rank 1
Share this question
or