Styles and Cascading Style Sheets

J

JezB

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.
 
A

avnrao

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.
 
J

JezB

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 ?
 
A

avnrao

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top