"Bridge" CSS Classes?

"Bridge" CSS Classes?

am 29.10.2007 15:10:33 von DC

Hi,

I designed many usercontrols and some webcontrols and I using css-
classes to style elements in these controls. I now have the
requirement to use these controls in a different webproject which has
central stylesheets to which I must attach.

I.e. I intended to change the style in the .css file containing the
definition for cssclass="xyz-style", but now I must change all
occurrences (some for the webcontrols in codebehind) to cssclass="abc-
style".

I am not good at webdesign and I always wonder how to reuse the aspx/
ascx parts, but inserting different classes does not seem logical to
me. I guess I could use a construct like cssclass="<% =Styles.Style1
%>" but I was hoping there is a better way to bridge the "abc-style"
to the "xyz-style".

Thanks for any hint on this in advance,
Regards
DC

Re: "Bridge" CSS Classes?

am 30.10.2007 09:41:10 von peter.bucher

Helllo DC

Maybe you`r searching for "themes and skins"
- http://www.google.ch/search?hl=de&q=asp.net+skins+themes&met a=

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET

Re: "Bridge" CSS Classes?

am 06.11.2007 16:02:45 von DC

On 30 Okt., 09:41, "Peter Bucher [MVP]"
wrote:
> Helllo DC
>
> Maybe you`r searching for "themes and skins"
> -http://www.google.ch/search?hl=de&q=asp.net+skins+themes&me ta=
>
> --
> Gruss, Peter Bucher
> Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerlandhttp://www.aspnetzone.de/- ASP.NET Zone, die ASP.NET Communityhttp://www.aspnetzone.de/blogs/peterbucher/- Auf den Spuren von .NET

Thank you, Peter. Themeing is not exactly what I am looking for. I
have now decided that it will be too much effort to adapt to external
stylesheets, since many of the external styles are not applicable to
my layout anyway. However, it would be nice to import some properties,
simple stuff like font face and sizes, from the external stylesheet. I
guess this is not possible, at least no without producing the local
style sheet on the fly (and mixing some of the styles). The css
@import directive won't help since the external stylesheet contains
named elements unknown to my application.

Regards
DC

RE: "Bridge" CSS Classes?

am 28.01.2008 21:48:01 von Geo

Hi, Your problem is a bit tricky. There are somethings you have figure out
first.
1. Style which never change irrespective of which project you are using in.
like width or height of the control, etc.
2. Style which MUST change - like color and font
3. CssClass's which can be set on the fly dynamically. Like, if you want to
show a different style when the control is enabled and a different one when
enabled...

The solution what I could think of is..
For 1. This must be a part of your user control, defined on the page or
mapped to it. So that the control has it everytime.
For 2. This must be given from the common theme file of the project. Just
make sure that you call same css class names always.
For 3. Define properties and set them - so u can use them on the fly.

Let me know if you any troubles with this and maybe i could be more
descriptive.



"DC" wrote:

> Hi,
>
> I designed many usercontrols and some webcontrols and I using css-
> classes to style elements in these controls. I now have the
> requirement to use these controls in a different webproject which has
> central stylesheets to which I must attach.
>
> I.e. I intended to change the style in the .css file containing the
> definition for cssclass="xyz-style", but now I must change all
> occurrences (some for the webcontrols in codebehind) to cssclass="abc-
> style".
>
> I am not good at webdesign and I always wonder how to reuse the aspx/
> ascx parts, but inserting different classes does not seem logical to
> me. I guess I could use a construct like cssclass="<% =Styles.Style1
> %>" but I was hoping there is a better way to bridge the "abc-style"
> to the "xyz-style".
>
> Thanks for any hint on this in advance,
> Regards
> DC
>
>