How to set SkinID of a control contained in a composite server control?
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
I have a composite server control and I create some dynamic controls in it, like so:
public class MyControl : CompositeControl
{
private Panel panel;protected override void CreateChildControls() { // Clear controls. Controls.Clear(); // Create controls. panel = new Panel(); panel.ID = "Panel1"; panel.SkinID = "Panel1" // Add controls. Controls.Add(panel); } protected override void Render(HtmlTextWriter writer) { panel.RenderControl(writer); }
}
The said server control is placed on a page which uses a stylesheet theme, which has a skin file containing a declaration for a Panel skin, like so:
<asp:Panel SkinID="Panel1" runat="server" BackImageUrl="top-panel.gif"></asp:Panel>
However, the skin is never applied... Am I missing something or doing something wrong? Perhaps
CreateChildControls
override is a bad place to do that?