Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Applying styles from multiple sources

Reply
Thread Tools

Applying styles from multiple sources

 
 
DalePres
Guest
Posts: n/a
 
      06-26-2004
Is there a way to determine the order or priority of applying styles in a
custom web control? For example, I have a control with default style
settings for many features, and exposed public properties to change those
settings as well. It is easy enough to set the value of the public property
to the default, then use the public property to render my control.

Where it becomes more confusing is when applying style sheets. If a
developer uses my control and applies a style sheet, I have no way of
knowing which style parameters he has applied in the style sheet. Therefore
I don't know which default styles to leave out of my rendering.

So the bottom line is, I think, how to prioritize and apply styles from
default styles, public property styles, and css class styles.

Thanks,

Dale


 
Reply With Quote
 
 
 
 
Dale
Guest
Posts: n/a
 
      06-29-2004
Second try here... Microsoft, Where're those 48 hour responses advertised in
my MSDN subscription?

Is there a way to determine the order or priority of applying styles in a
custom web control? For example, I have a control with default style
settings for many features, and exposed public properties to change those
settings as well. It is easy enough to set the value of the public property
to the default, then use the public property to render my control.

Where it becomes more confusing is when applying style sheets. If a
developer uses my control and applies a style sheet, I have no way of
knowing which style parameters he has applied in the style sheet. Therefore
I don't know which default styles to leave out of my rendering.

So the bottom line is, I think, how to prioritize and apply styles from
default styles, public property styles, and css class styles.

Thanks,

Dale



 
Reply With Quote
 
 
 
 
Iain
Guest
Posts: n/a
 
      06-29-2004

> Is there a way to determine the order or priority of applying styles in a
> custom web control? For example, I have a control with default style
> settings for many features, and exposed public properties to change those
> settings as well. It is easy enough to set the value of the public

property
> to the default, then use the public property to render my control.
>


(I'm not microsoft, and am asking questions too - so don't expect too
much!).

Dale - I rather think that what happens will happen exactly as if all the
style elements had been included in the resulting html. In fact that may be
exactly how it works. Of course the style parse may well ignore overriden
elements, but it won't know which they are for elements in style sheets
defined outside .net.

So in short I wouldn't worry about it. Any specific style="" in an element
should override higher elements.

Accordingly you should look at the style prioritisation rules.

There's a little bit on this in 'Dynamic HTML' by Danny GOodman and no doubt
an incomprehensible standard at W3C somewhere.


Iain


 
Reply With Quote
 
Scott G.
Guest
Posts: n/a
 
      06-29-2004
I've dropped one of the groups from your xpost.

In general what I do is whenever someone sets the CssClass property of my control I drop all of the internally generated styling; unfortunately, a lot of this is browser dependent -- but in general, the style= attribute is the bottom of the cascade, and thus will override everything before it (modulo any browser bugs). There are some tricky bits here, since some of the CSS qualifiers can set several things at once, for example, one could have :

..tag { font: italic small-caps bold 12px arial; }

And in your HTML:

<foo class="tag" style="font-family: verdana;" >....

In this case we should have overridden the "arial"; but in practice that doesn't always work.

Anyway, because of these kinds of things, I do what I suggested above, which is to not generate a style= if the user sets the CssClass

An alternative might be to never assume any defaults for styling and then if the user of the control sets something, then it's set. Or since you have control of the control you are writing, you could add a property that says/does something like "NoStyleAttribute".

Scott
"Dale" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
Second try here... Microsoft, Where're those 48 hour responses advertised in
my MSDN subscription?

Is there a way to determine the order or priority of applying styles in a
custom web control? For example, I have a control with default style
settings for many features, and exposed public properties to change those
settings as well. It is easy enough to set the value of the public property
to the default, then use the public property to render my control.

Where it becomes more confusing is when applying style sheets. If a
developer uses my control and applies a style sheet, I have no way of
knowing which style parameters he has applied in the style sheet. Therefore
I don't know which default styles to leave out of my rendering.

So the bottom line is, I think, how to prioritize and apply styles from
default styles, public property styles, and css class styles.

Thanks,

Dale



 
Reply With Quote
 
q@q.com
Guest
Posts: n/a
 
      06-30-2004
Styles trickle down.

or
think bottom-up.

an embedded style overrides an inline style,
which in turn overrides linked stylesheets.

hope this helps

Dale wrote:

> Second try here... Microsoft, Where're those 48 hour responses advertised in
> my MSDN subscription?
>
> Is there a way to determine the order or priority of applying styles in a
> custom web control? For example, I have a control with default style
> settings for many features, and exposed public properties to change those
> settings as well. It is easy enough to set the value of the public property
> to the default, then use the public property to render my control.
>
> Where it becomes more confusing is when applying style sheets. If a
> developer uses my control and applies a style sheet, I have no way of
> knowing which style parameters he has applied in the style sheet. Therefore
> I don't know which default styles to leave out of my rendering.
>
> So the bottom line is, I think, how to prioritize and apply styles from
> default styles, public property styles, and css class styles.
>
> Thanks,
>
> Dale
>
>
>
>


 
Reply With Quote
 
DalePres
Guest
Posts: n/a
 
      07-02-2004
Thanks all for your advice on this one.

Dale

<(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Styles trickle down.
>
> or
> think bottom-up.
>
> an embedded style overrides an inline style,
> which in turn overrides linked stylesheets.
>
> hope this helps
>
> Dale wrote:
>
> > Second try here... Microsoft, Where're those 48 hour responses

advertised in
> > my MSDN subscription?
> >
> > Is there a way to determine the order or priority of applying styles in

a
> > custom web control? For example, I have a control with default style
> > settings for many features, and exposed public properties to change

those
> > settings as well. It is easy enough to set the value of the public

property
> > to the default, then use the public property to render my control.
> >
> > Where it becomes more confusing is when applying style sheets. If a
> > developer uses my control and applies a style sheet, I have no way of
> > knowing which style parameters he has applied in the style sheet.

Therefore
> > I don't know which default styles to leave out of my rendering.
> >
> > So the bottom line is, I think, how to prioritize and apply styles from
> > default styles, public property styles, and css class styles.
> >
> > Thanks,
> >
> > Dale
> >
> >
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying CSS Styles to Dropdownlist =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?= ASP .Net 4 05-15-2006 02:16 PM
Applying stylesheet styles to master page sasquatch ASP .Net 7 11-21-2005 07:57 PM
Applying stylesheet styles to master page sasquatch ASP .Net 0 11-20-2005 10:23 PM
Applying Styles Peter Aitken ASP .Net Web Controls 0 07-22-2004 06:27 PM
Applying styles from multiple sources DalePres ASP .Net Building Controls 4 07-02-2004 01:21 AM



Advertisments