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

User control inside dynamically created Dock

1 Answer 55 Views
Dock
This is a migrated thread and some comments may be shown as answers.
M Iftekharul
Top achievements
Rank 1
M Iftekharul asked on 06 May 2010, 05:13 PM
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;
        pnlDockContent.Controls.Add(LoadControl(contentURL));
        //dock.ContentContainer.Controls.Add(pnlDockContent);
        
        StringBuilder sb = new StringBuilder();
        StringWriter tw = new StringWriter(sb);
        HtmlTextWriter hw = new HtmlTextWriter(tw);

        pnlDockContent.RenderControl(hw);
        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?

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 11 May 2010, 02:34 PM
Hi,

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: http://demos.telerik.com/aspnet-ajax/xmlhttppanel/examples/default/defaultcs.aspx.

Regards,
Pero
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.
Tags
Dock
Asked by
M Iftekharul
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or