| re: Dynamically Apply CSS
Depends if you are using master template where you write out your own body
tag.
If you are you can easily massage the attribute of the body tag.
You can associate a class - just Object.CssClass=YourClass or you can use as
before
Object.Attributes.Add("Class",YourClass)
"Robert" <A@B.COM> wrote in message
news:uDeGv9hdEHA.3616@TK2MSFTNGP10.phx.gbl...[color=blue]
> Thanks for the quick and useful response - I'll certainly use it in some
> scenarios: A couple of followup questions:
> 1. Will this method work for the <body> element? (I definitely need to be
> able to set the <body bgcolor=...>) or will this only work for server
> controls?
> 2. Will this method let me associate a css class with the element being
> styled - or am I limited only to applying inline css attributes?
>
> Thanks!
>
>
>
> "AsyaHubby" <asyahubby@hotmail.com> wrote in message
> news:O0NcZxhdEHA.2752@TK2MSFTNGP12.phx.gbl...[color=green]
> > just add attributes to objects at runtime.
> >
> > txt.attributes.add("Style", YourStyleStringHere)
> >
> > This will render the style attribute for the input tag with the given
> > settings
> >
> > "Robert" <A@B.COM> wrote in message
> > news:O60ShohdEHA.228@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Are there any other ways to dynamically apply CSS styling to a page[/color]
> > (without[color=darkred]
> > > using inline CSS)?
> > >
> > > I'm sure I could dynamically generate a new and uniquely named CSS[/color][/color][/color]
file[color=blue][color=green]
> > "on[color=darkred]
> > > the fly" when users log in, and then dynamically associate that css[/color][/color][/color]
file[color=blue][color=green][color=darkred]
> > > with the requested pages - but I'm looking for something much simpler[/color][/color]
> and[color=green][color=darkred]
> > > with better runtime performance.
> > >
> > > Here's what I'm after. I plan to let users save various preferences[/color]
> > between[color=darkred]
> > > sessions. Behind the scenes I save this information with their account[/color]
> > data[color=darkred]
> > > in a database. Some of these preferences include page background color[/color][/color]
> and[color=green][color=darkred]
> > > font size - which I want to apply to their pages at runtime via CSS.[/color][/color]
> There[color=green][color=darkred]
> > > will also be a couple of css classes to be applied to various elements[/color][/color]
> in[color=green][color=darkred]
> > > the page.
> > >
> > > I'm already storing all of the css settings and classes in the[/color][/color][/color]
database,[color=blue][color=green]
> > and[color=darkred]
> > > I'd like to leverage it all from there if possible.
> > >
> > > Any suggestions for accomplishing this?
> > >
> > > Thanks!
> > >
> > >[/color]
> >
> >[/color]
>
>[/color] |