Connecting Tech Pros Worldwide Forums | Help | Site Map

Styles and Cascading Style Sheets

JezB
Guest
 
Posts: n/a
#1: Nov 18 '05
Is it possible to programatically examine and modify a page's Styles
(including Cascading Style Sheets) within the code-behind-module (eg. c#) ?

My guess is that since these are HTML elements the answer is no, since these
will only exist in the browser whereas the code-behind runs on the web
server, but I wanted verification from you experts out there (I'm new to
ASP.NET).

If the answer is no, is it possible via javascript ?

Thanks in advance.



avnrao
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Styles and Cascading Style Sheets


for web controls : you can set CSSClass property in code behind.
as you said for HTML controls - you cant set it in code behind, but you can
set it in javascript at the client side.

control.style.className = "stylename";

Av.

"JezB" <jezb@somewhere.com> wrote in message
news:OcmJVPqLEHA.1892@TK2MSFTNGP10.phx.gbl...[color=blue]
> Is it possible to programatically examine and modify a page's Styles
> (including Cascading Style Sheets) within the code-behind-module (eg. c#)
> ?
>
> My guess is that since these are HTML elements the answer is no, since
> these
> will only exist in the browser whereas the code-behind runs on the web
> server, but I wanted verification from you experts out there (I'm new to
> ASP.NET).
>
> If the answer is no, is it possible via javascript ?
>
> Thanks in advance.
>
>[/color]


JezB
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Styles and Cascading Style Sheets


But how can I examine and manipulate what is IN those styles ? eg. the
FONT-WEIGHT property of a style. Is this by javascript only ?

"avnrao" <avn@newsgroups.com> wrote in message
news:OvMFjhqLEHA.140@TK2MSFTNGP09.phx.gbl...[color=blue]
> for web controls : you can set CSSClass property in code behind.
> as you said for HTML controls - you cant set it in code behind, but you[/color]
can[color=blue]
> set it in javascript at the client side.
>
> control.style.className = "stylename";
>
> Av.
>
> "JezB" <jezb@somewhere.com> wrote in message
> news:OcmJVPqLEHA.1892@TK2MSFTNGP10.phx.gbl...[color=green]
> > Is it possible to programatically examine and modify a page's Styles
> > (including Cascading Style Sheets) within the code-behind-module (eg.[/color][/color]
c#)[color=blue][color=green]
> > ?
> >
> > My guess is that since these are HTML elements the answer is no, since
> > these
> > will only exist in the browser whereas the code-behind runs on the web
> > server, but I wanted verification from you experts out there (I'm new to
> > ASP.NET).
> >
> > If the answer is no, is it possible via javascript ?
> >
> > Thanks in advance.
> >
> >[/color]
>
>[/color]


avnrao
Guest
 
Posts: n/a
#4: Nov 18 '05

re: Styles and Cascading Style Sheets


generally style sheets are used for putting the styles in one place. if you
want to programmatically change, its good practice to change only the name
of the style to some other style that is in the CSS file.
i am not sure of your requirement. do want to modify for server controls or
for html controls ?
Av.


"JezB" <jezb@somewhere.com> wrote in message
news:OK8nhlqLEHA.3472@TK2MSFTNGP09.phx.gbl...[color=blue]
> But how can I examine and manipulate what is IN those styles ? eg. the
> FONT-WEIGHT property of a style. Is this by javascript only ?
>
> "avnrao" <avn@newsgroups.com> wrote in message
> news:OvMFjhqLEHA.140@TK2MSFTNGP09.phx.gbl...[color=green]
>> for web controls : you can set CSSClass property in code behind.
>> as you said for HTML controls - you cant set it in code behind, but you[/color]
> can[color=green]
>> set it in javascript at the client side.
>>
>> control.style.className = "stylename";
>>
>> Av.
>>
>> "JezB" <jezb@somewhere.com> wrote in message
>> news:OcmJVPqLEHA.1892@TK2MSFTNGP10.phx.gbl...[color=darkred]
>> > Is it possible to programatically examine and modify a page's Styles
>> > (including Cascading Style Sheets) within the code-behind-module (eg.[/color][/color]
> c#)[color=green][color=darkred]
>> > ?
>> >
>> > My guess is that since these are HTML elements the answer is no, since
>> > these
>> > will only exist in the browser whereas the code-behind runs on the web
>> > server, but I wanted verification from you experts out there (I'm new
>> > to
>> > ASP.NET).
>> >
>> > If the answer is no, is it possible via javascript ?
>> >
>> > Thanks in advance.
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]


coollzh
Guest
 
Posts: n/a
#5: Nov 18 '05

re: Styles and Cascading Style Sheets


you can user HTML Control runing at server
then you can the style of the element

"JezB" <jezb@somewhere.com> 写入消息
news:OcmJVPqLEHA.1892@TK2MSFTNGP10.phx.gbl...[color=blue]
> Is it possible to programatically examine and modify a page's Styles
> (including Cascading Style Sheets) within the code-behind-module (eg. c#)[/color]
?[color=blue]
>
> My guess is that since these are HTML elements the answer is no, since[/color]
these[color=blue]
> will only exist in the browser whereas the code-behind runs on the web
> server, but I wanted verification from you experts out there (I'm new to
> ASP.NET).
>
> If the answer is no, is it possible via javascript ?
>
> Thanks in advance.
>
>[/color]


JezB
Guest
 
Posts: n/a
#6: Nov 18 '05

re: Styles and Cascading Style Sheets


Could you give me a simple example ?

"coollzh" <coollzh@hotmail.com> wrote in message
news:%23vgZCAsLEHA.1192@TK2MSFTNGP11.phx.gbl...[color=blue]
> you can user HTML Control runing at server
> then you can the style of the element
>
> "JezB" <jezb@somewhere.com> 写入消息
> news:OcmJVPqLEHA.1892@TK2MSFTNGP10.phx.gbl...[color=green]
> > Is it possible to programatically examine and modify a page's Styles
> > (including Cascading Style Sheets) within the code-behind-module (eg.[/color][/color]
c#)[color=blue]
> ?[color=green]
> >
> > My guess is that since these are HTML elements the answer is no, since[/color]
> these[color=green]
> > will only exist in the browser whereas the code-behind runs on the web
> > server, but I wanted verification from you experts out there (I'm new to
> > ASP.NET).
> >
> > If the answer is no, is it possible via javascript ?
> >
> > Thanks in advance.
> >
> >[/color]
>
>[/color]


Closed Thread