Web user controls use there own css file?

A

Arjen

Hello,

I have some web user controls that use some style sheets for them self.
Now what is the best way?
- Add everything in one css file?
- Or create a css file for each web user control?

If I choose the last option, how can I add the "<link href..." code inside
the head of the page from the web user control?

Thanks!
 
S

S. Justin Gengo

Arjen,

I think you may be confused as to how the web user controls work.

Web user controls don't have their own <head> sections.

Each web user control gets included within the form tags of the page it's
placed on. Therefore all the user controls on a page use that page's style
sheet.

What you might want to do is set up style class names and then assign that
class name to each object in the user control you want that class to apply
to.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
A

Arjen

Of course I know that... but I want to know if it is posible to add some
thing to the head section from out a web user control. (in code behind)

Thanks!
 
A

Ananda Sim

Hi S. Justin,

How do I stop VS.NET 2002, 2003 from deleting the runat="server" every
second save?

Thanks

Ananda
 
F

Frank Drebin

I think it does that because <head></head> is a native HTML tag. Try putting
what you need in a <span></span> tag within <head></head>
 
A

Ananda Sim

Hi Frank,

I'll certainly try that. Or <div> </div>

But seems like a bunch more unexpected html inside <head></head>

I agree with you that <head> is a native HTML tag.

But seems to me that asp.net is quite happy to make any native HTML tag a
serverside tag by using runat="server" and it maps to htmlgeneric object.

And Visual Studio is more than happy to intellisense and help you
autocomplete the runat="server" attribute when you edit the code.

But the IDE validation and save routine strips that out against the
recommendations of the editor and against the recommendations of asp.net

Thanks
Ananda
 
S

S. Justin Gengo

Ananda,

This is why I said be careful. I noticed this behaviour and I have no idea
how to stop it from occurring! Quite annoying. I think we can chalk it up to
a bug.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top