Web user controls use there own css file?

  • Thread starter Thread starter Arjen
  • Start date Start date
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!
 
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
 
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!
 
Hi S. Justin,

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

Thanks

Ananda
 
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>
 
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
 
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
 
Back
Top