Hi there,
I've got a user control that uses it's own CSS classes. At the moment, I've
put those CSS classes in the <head> section of the ASPX page containing the
user control.
Ideally, I'd like the user control specific CSS to live with the user
control so that the user control can be reused as one single unit. Also, if
there is more than one instance of the user control on the same page, the
user control specific CSS should only be emitted once.
Does anyone have any suggestions for how to achieve this? How is everyone
else handling this situation?
Cheers.
Masudur - 19 Mar 2008 11:23 GMT
> Hi there,
>
[quoted text clipped - 11 lines]
>
> Cheers.
Hi,
you can develop a separate style sheet for usercontrol and and in
usercontrol link the style sheet...
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="Footer.ascx.cs" Inherits="TME.UI.UserControls.Footer" %>
<link type="text/css" rel="Stylesheet" href="../App_Themes/Default/
default.css" />
<div>
</div>
but as u can see if multiple instance of user control placed in page
you got multiple style reference link...
gain to over come the problem you have to put this link in page ...
that is what you are doing now...
its pretty good..
But will suffer from few problem if you use theme based web site...
Thanks & Best of Luck
Md. Masudur Rahman
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
gerry - 19 Mar 2008 14:37 GMT
We came up with a StyleSheetManager that functions similar to the
ScriptManager.
Each control registers required stylesheets with the StyleSheetManager which
in turns renders the appropriate markup to the page.
The manager handles embedded stylesheets , external stylesheets and external
embedded resource stylesheets.
Any given stylesheet is only included in the page once and all stylesheets
end up in the header section where they should be.
> Hi there,
>
[quoted text clipped - 14 lines]
>
> Cheers.
Dune88 - 25 Mar 2008 01:35 GMT
Thanks for the suggestions, I'll give them a go.
> We came up with a StyleSheetManager that functions similar to the
> ScriptManager.
[quoted text clipped - 23 lines]
> >
> > Cheers.
marss - 25 Mar 2008 08:18 GMT
> Does anyone have any suggestions for how to achieve this? How is everyone
> else handling this situation?
>
> Cheers.
Here is my approach to runtime stylesheet registration, maybe it will
be useful for you:
http://marss.co.ua/StylesheetRegistration.aspx
Regards,
Mykola