By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

Styles and Cascading Style Sheets

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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" <je**@somewhere.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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.

Nov 18 '05 #2

P: n/a
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" <av*@newsgroups.com> wrote in message
news:Ov*************@TK2MSFTNGP09.phx.gbl...
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" <je**@somewhere.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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.


Nov 18 '05 #3

P: n/a
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" <je**@somewhere.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
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" <av*@newsgroups.com> wrote in message
news:Ov*************@TK2MSFTNGP09.phx.gbl...
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" <je**@somewhere.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
> 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.
>
>



Nov 18 '05 #4

P: n/a
you can user HTML Control runing at server
then you can the style of the element

"JezB" <je**@somewhere.com> 写入消息
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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.

Nov 18 '05 #5

P: n/a
Could you give me a simple example ?

"coollzh" <co*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
you can user HTML Control runing at server
then you can the style of the element

"JezB" <je**@somewhere.com> 写入消息
news:Oc**************@TK2MSFTNGP10.phx.gbl...
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.


Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.