I hacve a basic aspx page that loads in a web control (ascx)
Is there any way I can associate the ascx with a css?
If so, how, do i need to have the css on the main page, or on the control. (or can I not use a css on a web control like this ?)
If the css is in the containing page it will be applied to all elements in the control.
You could write a <link href=.... /> tag into your ascx page if you only wanted it to be applied when the user contrl was included in the page, but this would produce invalid html because the linktag should only appear in the head of the document.
If your bothered about this (like me) then you could make the <head> of the page a HtmlGenericControl. Look up through the control hierarchy to the page, find the head control and add the link to it as a literal. Bit of a phaff though, it just depends on wether non-standards compliant HTML will keep you up at night ;-)
I think there is a real requirement for a Page.RegisterClientStyleSheet method a bit like Page.RegisterClientScript to handle this for you. Haven't heard of it for 2005 though so I guess its just wishful thinking....
Rob
Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
into my header1.ascx page but it's not doing anything.
i put it <head></head> tags around it but when i hop from code view to design view back to code view it takes the <link ... out of and just below the Head tags
i know i am stupid, but what am i doing wrong here.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.