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?