Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to set SkinID of a control contained in a composite server control?

How to set SkinID of a control contained in a composite server control?

Scheduled Pinned Locked Moved ASP.NET
sysadmintutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pawel Krakowiak
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups