473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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=""/>
Jun 5 '07 #1
4 2315
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" <te*******@hotmail.comwrote in message
news:eA**************@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=""/>


Jun 6 '07 #2
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" <st*******@community.nospamwrote in message
news:up*************@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" <te*******@hotmail.comwrote in message
news:eA**************@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=""/>



Jun 6 '07 #3
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" <te*******@hotmail.comwrote in message
news:Ox**************@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" <st*******@community.nospamwrote in message
news:up*************@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" <te*******@hotmail.comwrote in message
news:eA**************@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=""/>




Jun 6 '07 #4
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" <st*******@community.nospamwrote in message
news:Oi**************@TK2MSFTNGP05.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" <te*******@hotmail.comwrote in message
news:Ox**************@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" <st*******@community.nospamwrote in message
news:up*************@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" <te*******@hotmail.comwrote in message
news:eA**************@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=""/>




Jun 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Frédéric Mayot | last post by:
Hi I'm trying to define a skin for a custom control. I can't see how to do it... My custom control inherits from a TextBox but it doesn't recognize the skinID defined for asp:TextBox. Any idea ?...
0
by: Kelvin.YuShen | last post by:
Hello there, I got a problem when I was uploading the skin I developed. Following is the code from my original skin template (skin.htm): <TABLE cellspacing="3" cellpadding="3" width="100%"...
8
by: scotty | last post by:
Can a .skin file be created without visual studio? Thanks, Scott
3
by: Steve B. | last post by:
Hi, I'd like to apply a css class on all cells in all gridviews in my app. To achieve that, I have to set hte item-style cssclass property of each columns. If I add this to my skin file : ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.