Something odd must be happening.
The answer to my riddle was how I identify the theme in web.config. I was
using the attribute stylesheettheme="myThemeName" and I changed it to
theme="myThemeName".
...
> T,
> The Init event is where the controls are initialized, which is why in
> PreInit the controls are not yet initialized. If you override the OnInit
> or OnInitComplete method, you should be able to set control themes there.
> Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
> MyBase.OnInit(e)
> Me.button1.Theme = ""
> End Sub
> Hope this helps,
> Steve
> "T Samualson" <tera_8@hotmail.com> wrote in message
> news:Oxz$1FFqHHA.4632@TK2MSFTNGP04.phx.gbl...
>> Thanks Steve - I was doing that but I thought I would post a simplified
>> version for the news group.
>> I have found a few hints about doing it in Page_PreInit() but the
>> controls are all null still. I created an instance of the master page in
>> pre-init also so my controls are available but my controls still arent
>> skinning.
>> What event do you skin your controls in? My controls need to be added
>> during a btn_onClick event... any help would be greatly appreciated.
>> "PlatinumBay" <stevan@community.nospam> wrote in message
>> news:up7sea9pHHA.588@TK2MSFTNGP06.phx.gbl...
>>> T,
>>> You need to set the SkinID property of the TextBox.
>>> TextBox newTextBox = new TextBox();
>>> newTextBox.SkinID = "TextBoxSkin";
>>> TextBoxPlaceHolder.Controls.Add(new TextBox());
>>> In the skin file, you must also include the SkinID attribute.
>>> <asp:TextBox runat="server" SkinID="TextBoxSkin"
>>> Style="background-color:lightblue;" Visible="true" Text=""/>
>>> Hope this helps,
>>> Steve
>>> "T Samualson" <tera_8@hotmail.com> wrote in message
>>> news:eAcPBX7pHHA.1244@TK2MSFTNGP04.phx.gbl...
>>>>I am programmatically adding controls to my user control but my skin is
>>>>not being applied to the control.
>>>> The code gets executed in a btn_Click event. I have tried specifically
>>>> setting the skinId property with no luck.
>>>> Any ideas?
>>>> Here is my simplified code:
>>>> TextBox newTextBox = new TextBox();
>>>> TextBoxPlaceHolder.Controls.Add(new TextBox());
>>>> And my skin:
>>>> <asp:TextBox runat="server" Style="background-color:lightblue;"
>>>> Visible="true" Text=""/>