473,471 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why isn't my style being used ?

Im my Page_Load method I create a label dynamically and add it to my Page:

Label l = new Label();
l.Text = "Example";
l.CssClass = "H2";
this.Controls.Add(l);

My page is linked to an external stylesheet, but when the control is
rendered it is not using the H2 style - what am I missing ?
Nov 18 '05 #1
6 1139
Does it work with something else ? H2 could perhaps conflict with html H2
tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
Im my Page_Load method I create a label dynamically and add it to my Page:

Label l = new Label();
l.Text = "Example";
l.CssClass = "H2";
this.Controls.Add(l);

My page is linked to an external stylesheet, but when the control is
rendered it is not using the H2 style - what am I missing ?

Nov 18 '05 #2
There is no html H2 tag ... I've only just started learning about
stylesheets so I may be doing something silly.

"Patrice" <no****@nowhere.com> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
Does it work with something else ? H2 could perhaps conflict with html H2
tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
Im my Page_Load method I create a label dynamically and add it to my Page:
Label l = new Label();
l.Text = "Example";
l.CssClass = "H2";
this.Controls.Add(l);

My page is linked to an external stylesheet, but when the control is
rendered it is not using the H2 style - what am I missing ?


Nov 18 '05 #3
Hi

In CSS
..myClass
{
font-family:verdana,arial
}

l..CssClass = "myClass";

More info
http://msdn.microsoft.com/library/de...ence_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.icysoft.com/
http://www.microsoft.com/technet/scriptcenter

No matter where you go there you are
==============================
"JezB" <je**@somewhere.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...
There is no html H2 tag ... I've only just started learning about
stylesheets so I may be doing something silly.

"Patrice" <no****@nowhere.com> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
Does it work with something else ? H2 could perhaps conflict with html H2
tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
> Im my Page_Load method I create a label dynamically and add it to my Page: >
> Label l = new Label();
> l.Text = "Example";
> l.CssClass = "H2";
> this.Controls.Add(l);
>
> My page is linked to an external stylesheet, but when the control is
> rendered it is not using the H2 style - what am I missing ?
>
>



Nov 18 '05 #4
Show us the style sheet. You should have a dot before h2 so that it is taken
as a class name. If you used only "h2" in your style sheet, it is the style
to apply to the html h2 tag (which is used for headers).
Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:Oq**************@TK2MSFTNGP11.phx.gbl...
There is no html H2 tag ... I've only just started learning about
stylesheets so I may be doing something silly.

"Patrice" <no****@nowhere.com> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
Does it work with something else ? H2 could perhaps conflict with html H2
tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
Im my Page_Load method I create a label dynamically and add it to my

Page:
Label l = new Label();
l.Text = "Example";
l.CssClass = "H2";
this.Controls.Add(l);

My page is linked to an external stylesheet, but when the control is
rendered it is not using the H2 style - what am I missing ?



Nov 18 '05 #5
Ah I see ... so controls have to be based on a "custom" class rather than
one of the predefined HTML ones ?

"Vidar Petursson" <th**************************@icysoft.com> wrote in
message news:eq*************@TK2MSFTNGP10.phx.gbl...
Hi

In CSS
.myClass
{
font-family:verdana,arial
}

l..CssClass = "myClass";

More info
http://msdn.microsoft.com/library/de...ence_entry.asp
--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.icysoft.com/
http://www.microsoft.com/technet/scriptcenter

No matter where you go there you are
==============================
"JezB" <je**@somewhere.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...
There is no html H2 tag ... I've only just started learning about
stylesheets so I may be doing something silly.

"Patrice" <no****@nowhere.com> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
Does it work with something else ? H2 could perhaps conflict with html H2 tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
> Im my Page_Load method I create a label dynamically and add it to my

Page:
>
> Label l = new Label();
> l.Text = "Example";
> l.CssClass = "H2";
> this.Controls.Add(l);
>
> My page is linked to an external stylesheet, but when the control is
> rendered it is not using the H2 style - what am I missing ?
>
>



Nov 18 '05 #6
thanks .... still learning

"Patrice" <no****@nowhere.com> wrote in message
news:eJ*************@TK2MSFTNGP11.phx.gbl...
Show us the style sheet. You should have a dot before h2 so that it is taken as a class name. If you used only "h2" in your style sheet, it is the style to apply to the html h2 tag (which is used for headers).
Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:Oq**************@TK2MSFTNGP11.phx.gbl...
There is no html H2 tag ... I've only just started learning about
stylesheets so I may be doing something silly.

"Patrice" <no****@nowhere.com> wrote in message
news:u2**************@TK2MSFTNGP12.phx.gbl...
Does it work with something else ? H2 could perhaps conflict with html H2 tag ???

Patrice

"JezB" <je**@somewhere.com> a écrit dans le message de
news:%2*****************@TK2MSFTNGP10.phx.gbl...
> Im my Page_Load method I create a label dynamically and add it to my

Page:
>
> Label l = new Label();
> l.Text = "Example";
> l.CssClass = "H2";
> this.Controls.Add(l);
>
> My page is linked to an external stylesheet, but when the control is
> rendered it is not using the H2 style - what am I missing ?
>
>



Nov 18 '05 #7

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

Similar topics

83
by: rahul8143 | last post by:
hello, what is difference between sizeof("abcd") and strlen("abcd")? why both functions gives different output when applied to same string "abcd". I tried following example for that. #include...
13
by: | last post by:
I'm curious if anyone knows why the C# and VB.NET compilers don't automatically call Dispose() on objects that support IDisposable when they go out of scope. I asked a co-worker and his response...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
161
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.....
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
6
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE ||...
206
by: WaterWalk | last post by:
I've just read an article "Building Robust System" by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a...
1
SammyB
by: SammyB | last post by:
Where do they dream up these object names? Never mind... We had a program where we used a bunch of styles in a Document in a JTextPane. Everything worked fine until they wanted us to make a...
13
by: Andrew Falanga | last post by:
HI, Just a warning, I'm a javascript neophyte. I'm writing a function to validate the contents of a form on a web page I'm developing. Since I'm a neophyte, this function is quite simple at...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.