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 being applied to the control. If I declare the control in my aspx page it works ok, but if I try to do it programmatically it does not work.
Answer is here:
https://connect.microsoft.com/VisualStudio/feedback/details/558947/apply-skin-to-a-control-created-programatically
“The ASP.NET theming system has restrictions on when different theme information can be set. The Theme property can be set during PreInit. However StyleSheetTheme is processed at compilation time and thus cannot overriden programmatically in an event like PreInit.”