Dynamic RadDock-structure only keeps track of non-dynamic RadDockZone

4 posts, 0 answers
  1. Christoffer Rosenqvist
    Christoffer Rosenqvist avatar
    28 posts
    Member since:
    Oct 2009

    Posted 30 Oct 2009 Link to this post

    I have a .aspx page where I have a RadDockLayout and a RadDockZone registered as this:
    <telerik:RadDockLayout ID="rdlDockLayout" runat="server" OnLoadDockLayout="rdlDockLayout_LoadDockLayout" 
        OnSaveDockLayout="rdlDockLayout_SaveDockLayout"
        <telerik:RadDockZone ID="rdzMain" UniqueName="rdzMain" runat="server" MinHeight="600px" 
            Width="550px" BorderStyle="None"
        </telerik:RadDockZone> 
        <div style="display: none"
            <%--Hidden UpdatePanel, which is used to receive the new dock controls.--%> 
            <%--We will move them with script to the desired initial dock zone.--%> 
            <asp:UpdatePanel runat="server" ID="udpPanel" OnLoad="udpPanel_Load"
                <Triggers> 
                    <asp:AsyncPostBackTrigger ControlID="cmdNewDockWithZone" EventName="Click" /> 
                    <asp:AsyncPostBackTrigger ControlID="cmdNewDock" EventName="Click" /> 
                </Triggers> 
            </asp:UpdatePanel> 
        </div> 
    </telerik:RadDockLayout> 

    I'm adding new Docks to the page via the UpdatePanel and placing the using script as illustrated in this example. Some docks are created with a DockZone and some are placed in these dynamically created DockZones.

    Now I want to be able to react to the placed docks from code behind during the AJAX call backs but it seems that the DockZones are "lost" after they have been created. I.e. only the non-dynamic DockZone (rdzMain) is registered in rdlDockLayout.RegisteredZones and when calling rdlDockLayout.GetRegisteredDocksState() all Docks that are docked in dynamically created DockZones have an empty string for DockZoneID. This makes it hard to figure out which Dock belongs to which DockZone, which is important to my application.

    DockZones have the same string (unique per DockZone though) set as both ID and UniqueName.

    Is something wrong or is this the expected behavior when creating DockZones dynamically?


  2. Christoffer Rosenqvist
    Christoffer Rosenqvist avatar
    28 posts
    Member since:
    Oct 2009

    Posted 30 Oct 2009 Link to this post

    As per this post I'm using the following code to add DockZones to Docks:
    private void AddTargetGroupDockZone(RadDock dock) { 
        RadDockZone dockZone = CreateDockZone(); 
        dockZone.MinHeight = Unit.Pixel(40); 
        dockZone.Height = Unit.Percentage(100); 
        dockZone.Width = Unit.Pixel(500); 
        dock.ContentContainer.Controls.Add(dockZone); 
    private RadDockZone CreateDockZone() { 
        RadDockZone dockZone = new RadDockZone(); 
        dockZone.UniqueName = string.Format(DockZoneIDFormat, Guid.NewGuid()); 
        dockZone.ID = dockZone.UniqueName; 
        dockZone.BorderStyle = BorderStyle.None; 
        return dockZone; 

    At no time do I add the dynamic DockZones to the RadDockLayout, from code behind or via client script, and I don't save any kind of DockZone-state as I do with the Docks. Might this be a reason? Is there som client-side API that should be used with DockZones to add them to the RadDockLayout so they get registered in the RegisteredZones or can't this be done dynamically?


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Christoffer Rosenqvist
    Christoffer Rosenqvist avatar
    28 posts
    Member since:
    Oct 2009

    Posted 02 Nov 2009 Link to this post

    The key to solving this problem seems to be to add the dockzone to the dock everytime you recreate it in the Page.Init method. I do this by having a Dictionary where I store the Dock.ID as key and the DockZone.ID as value. Then when I recreate the Dock from state I check if the Dock.ID is in the key collection of the Dictionary. If it is I get the DockZone.ID from the Dictionary value collection and recreate a DockZone and add it to the Dock.ContentContainer.Controls-collection.
  5. AndyRutter
    AndyRutter avatar
    32 posts
    Member since:
    Mar 2009

    Posted 09 Nov 2009 Link to this post

    Hi there,
    Any chance of supplying a sample of the code you are using to do this?

    Cheers
    Brian
Back to Top