User control inside dynamically created Dock

2 posts, 0 answers
  1. M Iftekharul
    M Iftekharul avatar
    4 posts
    Member since:
    Apr 2008

    Posted 06 May 2010 Link to this post

    I'm trying to add a user control inside a dynamically created dock. My add method looks as follows:

    private RadDock CreateRadDock(string title, string contentURL, string forbiddenZone)
            RadDock dock = new RadDock();
            dock.DockMode = DockMode.Docked;
            dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);
            dock.Title = title;
            dock.Width = Unit.Percentage(100);
            dock.ForbiddenZones = forbiddenZone.Split(',');

            //dock.Commands.Add(new DockCloseCommand());
            dock.Commands.Add(new DockExpandCollapseCommand());

            Panel pnlDockContent = new Panel();
            pnlDockContent.ID = "Content" + dock.UniqueName;
            StringBuilder sb = new StringBuilder();
            StringWriter tw = new StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(tw);

            dock.Text = sb.ToString();
            return dock;

    This works fine if the user control i'm loading doesn't have any Asp.Net controls. But whenever there's an Asp.Net control inside, the pnlDockContent.RenderControl call fails & that's obvious. The issue for which i had to chose this way is if the dock content is added as a control, the content doesn't persist on drag & drop of the dock. Can someone please help me with this?
  2. Pero
    Pero avatar
    1156 posts

    Posted 11 May 2010 Link to this post


    You could use the XmlHttpPanel control to load the user control inside the dock. Simply place the XmlHttpPanel within content container of the dock, and load the user control inside the XmlHttpPanel. Please explore our online demos for more information on RadXmlHttpPanel:

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top