473,769 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Skin not being applied

I am programmaticall y 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();
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

And my skin:
<asp:TextBox runat="server" Style="backgrou nd-color:lightblue ;"
Visible="true" Text=""/>
Jun 5 '07 #1
4 2329
T,

You need to set the SkinID property of the TextBox.

TextBox newTextBox = new TextBox();
newTextBox.Skin ID = "TextBoxSki n";
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

In the skin file, you must also include the SkinID attribute.

<asp:TextBox runat="server" SkinID="TextBox Skin"
Style="backgrou nd-color:lightblue ;" Visible="true" Text=""/>

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:eA******** ******@TK2MSFTN GP04.phx.gbl...
>I am programmaticall y 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();
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

And my skin:
<asp:TextBox runat="server" Style="backgrou nd-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.

"PlatinumBa y" <st*******@comm unity.nospamwro te in message
news:up******** *****@TK2MSFTNG P06.phx.gbl...
T,

You need to set the SkinID property of the TextBox.

TextBox newTextBox = new TextBox();
newTextBox.Skin ID = "TextBoxSki n";
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

In the skin file, you must also include the SkinID attribute.

<asp:TextBox runat="server" SkinID="TextBox Skin"
Style="backgrou nd-color:lightblue ;" Visible="true" Text=""/>

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:eA******** ******@TK2MSFTN GP04.phx.gbl...
>>I am programmaticall y 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();
TextBoxPlaceHo lder.Controls.A dd(new TextBox());

And my skin:
<asp:TextBox runat="server" Style="backgrou nd-color:lightblue ;"
Visible="tru e" 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.EventArg s)
MyBase.OnInit(e )

Me.button1.Them e = ""
End Sub

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:Ox******** ******@TK2MSFTN GP04.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.

"PlatinumBa y" <st*******@comm unity.nospamwro te in message
news:up******** *****@TK2MSFTNG P06.phx.gbl...
>T,

You need to set the SkinID property of the TextBox.

TextBox newTextBox = new TextBox();
newTextBox.Skin ID = "TextBoxSki n";
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

In the skin file, you must also include the SkinID attribute.

<asp:TextBox runat="server" SkinID="TextBox Skin"
Style="backgro und-color:lightblue ;" Visible="true" Text=""/>

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:eA******* *******@TK2MSFT NGP04.phx.gbl.. .
>>>I am programmaticall y 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();
TextBoxPlaceH older.Controls. Add(new TextBox());

And my skin:
<asp:TextBo x runat="server" Style="backgrou nd-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 ="myThemeNam e" and I changed it to
theme="myThemeN ame".

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.

"PlatinumBa y" <st*******@comm unity.nospamwro te in message
news:Oi******** ******@TK2MSFTN GP05.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.EventArg s)
MyBase.OnInit(e )

Me.button1.Them e = ""
End Sub

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:Ox******** ******@TK2MSFTN GP04.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*******@comm unity.nospamwro te in message
news:up******* ******@TK2MSFTN GP06.phx.gbl...
>>T,

You need to set the SkinID property of the TextBox.

TextBox newTextBox = new TextBox();
newTextBox.Skin ID = "TextBoxSki n";
TextBoxPlaceHol der.Controls.Ad d(new TextBox());

In the skin file, you must also include the SkinID attribute.

<asp:TextBox runat="server" SkinID="TextBox Skin"
Style="backgr ound-color:lightblue ;" Visible="true" Text=""/>

Hope this helps,
Steve

"T Samualson" <te*******@hotm ail.comwrote in message
news:eA****** ********@TK2MSF TNGP04.phx.gbl. ..
I am programmaticall y 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();
TextBoxPlace Holder.Controls .Add(new TextBox());

And my skin:
<asp:TextB ox runat="server" Style="backgrou nd-color:lightblue ;"
Visible="tru e" Text=""/>




Jun 6 '07 #5

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

Similar topics

7
4975
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 ? Thanks, Fred
0
2218
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%" border="0"> <TR> <TD class="toppane" colspan="3" valign="top"
8
5147
by: scotty | last post by:
Can a .skin file be created without visual studio? Thanks, Scott
3
17297
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 : <asp:GridView runat="server"
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.