Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Skin not being applied


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=""/>

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...

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,

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...

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".

Now I can change the theme whenever I want, not just in the OnInit() method
...even in my button OnClick event...

Im just reading up on the advantages of stylesheet theme vs theme and it
appears that stylesheet theme can be overridden...if you can get it to work
I guess.

"PlatinumBay" <stevan@community.nospam> wrote in message

news:OiSeWoGqHHA.3948@TK2MSFTNGP05.phx.gbl...

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc