Apply skin to a control created programatically

Posted by Luis on Stack Overflow See other posts from Stack Overflow or by Luis
Published on 2010-05-13T07:48:31Z Indexed on 2010/05/13 7:54 UTC
Read the original article Hit count: 475

Filed under:
|
|

Say I am creating a Textbox in the codebehind of a page like this:

protected override void OnInit(EventArgs e)
{  
      base.OnInit(e);
      TextBox test = new TextBox();
      test.SkinkId = "MySkin";
      placeHolder.Controls.Add(test);
} 

and in my skin file I have this:

<asp:TextBox
    runat="server"
    SkinId = "MySkin"
    Width="400"
/>

Why is the skin not beeing applied to the control. If i declare the control in my aspx page it works ok, but if I try to do it programatically it does not work...

Any solution?

Thanks

Luis

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#