views:

65

answers:

1

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

+1  A: 

Does it help if you place your code in the OnPreInit event? You might need to add it to the placeholder later, but you could create the control there.

Daniel Dyson
According to Microsoft it should work: http://msdn.microsoft.com/en-us/library/tx35bd89.aspx but I just tried with no luck :(
Luis
I just noticed that if I set the page's Theme property it works, but not the StyleSheetTheme...this must be a bug...
Luis