473,796 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Styles and Cascading Style Sheets

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
5 1682
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.c lassName = "stylename" ;

Av.

"JezB" <je**@somewhere .com> wrote in message
news:Oc******** ******@TK2MSFTN GP10.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
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******** *****@TK2MSFTNG P09.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.c lassName = "stylename" ;

Av.

"JezB" <je**@somewhere .com> wrote in message
news:Oc******** ******@TK2MSFTN GP10.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
generally style sheets are used for putting the styles in one place. if you
want to programmaticall y 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******** ******@TK2MSFTN GP09.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******** *****@TK2MSFTNG P09.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.c lassName = "stylename" ;

Av.

"JezB" <je**@somewhere .com> wrote in message
news:Oc******** ******@TK2MSFTN GP10.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
you can user HTML Control runing at server
then you can the style of the element

"JezB" <je**@somewhere .com> дÈëÏûÏ¢
news:Oc******** ******@TK2MSFTN GP10.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
Could you give me a simple example ?

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

"JezB" <je**@somewhere .com> дÈëÏûÏ¢
news:Oc******** ******@TK2MSFTN GP10.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
6827
by: Axel Dahmen | last post by:
I try to combine properties of several classes. This is done by assigning a space separated list of class definitions to an element. However, IE shows a kind of preference when choosing the right property which I think is probably wrong. Here's what it does: If two classes are defined in a stylesheet providing the same property, and if these two classes are assigned to one single element, the preference which class's property is used is...
6
3424
by: Christopher Benson-Manica | last post by:
Just FMI, if an external stylesheet is linked to a page (with <link>), will subsequent <style> tags override the values in the external stylesheet? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
4
1923
by: Thomas Mlynarczyk | last post by:
Hi, I just ran into some problems when I tried to "style" the <a> elements of a page. Basically, I have something like this: <div id="left"> <div id="menu"> <a href="bla">Bla</a> </div> <a href="foo">Bar</a>
2
2056
by: Herb Stull | last post by:
I'm trying to give users a choice of the visual interface used in my ASP.NET application using Cascading Style Sheets. Ideally I'd like to offer them several choices for backgrounds, fonts, etc. for the screens and controls and let them make a choice. Once they choose, all screens and controls will display using the guidelines from the style sheet selected. I've figured out how to add a class to the style sheet for the different...
1
1125
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application that has been running just fine for several months without any cascading style sheets. Suddenly several users have had problems with the layout of the screen. In particular some text boxes are getting too large and covering buttons and therefore preventing them from being pushed. It appears that some other application - or perhaps a plug-in - (probably an unwanted plug-in) changes the
5
2269
by: Peter Walburn | last post by:
Hi, I am writing a web based application in VB.Net. A lot of the forms in the applicaiotn have grids (datagrids) in them. I would like to have a style sheet which defines how the headers are going to look. There are going to be quite a few web applications and we want a similar look and feel to them all. So I thought we could use a CSS in order to define how
4
2317
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application that has been running just fine for several months without any cascading style sheets. Suddenly several users have had problems with the layout of the screen. In particular some text boxes are getting too large and covering buttons and therefore preventing them from being pushed. It appears that some other application - or perhaps a plug-in - changes the default browser settings and then causes...
1
4353
by: Eric Lindsay | last post by:
I am trying to understand the differences between and uses of persistent, default and alternate styles. I have read http://www.w3.org/TR/REC-html40/present/styles.html section 14.3.2 on specifying external style sheets in link using combinations of rel and using or not using the title attribute. I think I sort of understand rel="alternate stylesheet". It seems to be able to act something like the media="print" or media="handheld" or...
5
1513
by: MarkW | last post by:
I hope this is the correct place to post this: I am developing a web site for a e-commerce business I will be running. The site I'm setting up will be 50% store, 50% content. I'm not sure which shopping cart I'll be using yet (am looking at os-commerce and miva) but the other part will be content. I will be writing reviews of products, articles on the industry, and someday may have some blogging and forums and advertising. I have to...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10012
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.