Losing dynamically created DockZone state.

2 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 18 Jan 2011 Link to this post

    Hi all,

    I have been using Telerik's tutorials on how to dynamically add docks to a dock zone. Inside of my dock is a chart which has drill-down capability. I do not seem to be doing something correctly, however. When the user interacts with the chart (it seems) that some of the dock's initially set properties are being forgotten.

    Image: http://i.imgur.com/3Qrqn.png

    The upper image is a freshly created dock zone. The second image is moments after the user clicked a series on the chart and 'drilled down.' I placed breakpoints throughout my code and it seems that the upper bar is disappearing before Page_Init is called.

    In addition, if the user refreshes the page or grabs the dock and drags it, then allows it to drop back onto the dock zone, it resets to its initial state. The title bar becomes present again.

    Here is the relevant code I have written:

    protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
        foreach( RadListBoxItem item in e.SourceDragItems)
            RadDock dock = CreateRadDock();
            dock.Tag = item.Text;
            dock.Title = dock.Tag + CurrentDockStates.Count.ToString();

    private RadDock CreateRadDock()
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Docked;
        dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a"); //Why am I replacing with 'a' here?
        dock.ID = string.Format("RadDock{0}", dock.UniqueName);
        dock.Title = "Dock";
        dock.Skin = RadDockLayout1.Skin;
        dock.Width = Unit.Pixel(200);
        dock.EnableRoundedCorners = true;
        return dock;

    private void CreateSaveStateTrigger(RadDock dock)
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack = true;
        AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "DockPositionChanged";
        saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "Command";

    private void LoadContent(RadDock dock)
        switch (dock.Tag)
            case "Cat 5e Capacity":
                System.Web.UI.Control ctrl = Page.LoadControl("PowerUsage.ascx");

    RadDockLayout1_SaveDockLayout, LoadDockLayout, CurrentDockStates, CreateRadDockFromState are identical to those given in your examples. I believe the above should all be mostly identical, if not identical, as well. 

    The only difference I can see between my example and http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx is that my example does not use a 2nd UpdatePanel. Instead, I am using the RadAjaxManager to refresh the view after a user has drag/dropped/created a dock. 

    Does this seem correct? Can I provide more information?


    EDIT: I see why the state of the graph reverts to its top level view. During page_init all the docks call LoadContent again to, in theory, reload the content they were displaying before. In practice, a user has navigated one level deep into the chart and then LoadContent is called -- this retrieves the top level of the chart, not one level deep. Any advice on how to handle this scenario would be much appreciated -- I do not see a great way of handling this.
  2. Answer
    Pero avatar
    1156 posts

    Posted 21 Jan 2011 Link to this post

    Hi Sean,

    I created a sample project to try to reproduce the issue locally, but to no avail. I used RadChart with drill-down functionality. Please find the sample attached to the thread. The project is based on the MyPortal demo with the following changes:
    • Removed the invisible update panel, and made the other panel with UpdateMode="Always".
    • The dock are always added to the RadDockLayout, because the Chart relies on ViewState, and the dynamically create controls must be added to one and the same control all the time.
    Could you please send a sample project that demonstrates the issue, so we can observe it locally?
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. DevCraft R3 2016 release webinar banner
Back to Top