473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Create CSS StyleSheet at runtime

Hello,

How to create a CSS StyleSheet at runtime and added it an Asp:Label?
I am using Asp.Net 2.0.

Thanks,
Miguel

Sep 21 '06 #1
6 3304
"shapper" <md*****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
How to create a CSS StyleSheet at runtime and added it an Asp:Label?
Do you actually need to create an entire cascading stylesheet, or do just
need to apply some style(s) to an individual Label control...?
Sep 21 '06 #2
I need to create the stylesheet at runtime.

To aply the style to the label I would do MyLabel.CssClass =
"MyStyleSheet"
This part is easy.

The reason why I asked how to apply it is because I am not sure if
something changes when the stylesheet is created at runtime.

Anyway, do you know how to create the stylesheet at runtime?

And one more thing: what about adding the stylesheet, created at
runtime, to an existing CSS file?

Thanks,
Miguel

Mark Rae wrote:
"shapper" <md*****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
How to create a CSS StyleSheet at runtime and added it an Asp:Label?

Do you actually need to create an entire cascading stylesheet, or do just
need to apply some style(s) to an individual Label control...?
Sep 22 '06 #3
"shapper" <md*****@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
>I need to create the stylesheet at runtime.
Wow!
Anyway, do you know how to create the stylesheet at runtime?
Same way you would create any other text file:
http://aspalliance.com/152_How_to_Cr...le_in_ASP_NET_
And one more thing: what about adding the stylesheet, created at
runtime, to an existing CSS file?
Well, you'd have to open the existing CSS file, append the text from the
newly created CSS file into it, and save the existing CSS file.

Are you *really* sure you want to do this...?
Sep 22 '06 #4
control.style.add("thestyle","the value")

:)
"shapper" <md*****@gmail.comschreef in bericht
news:11**********************@d34g2000cwd.googlegr oups.com...
Hello,

How to create a CSS StyleSheet at runtime and added it an Asp:Label?
I am using Asp.Net 2.0.

Thanks,
Miguel

Sep 22 '06 #5
I have used dynamic stylesheets in a few places, it goes something like this
:

create the style sheet data - cache it somewhere -
session/application/cache/disk/...
reference the stylesheet in your page
write an http handler to catch the request for the stylesheet, retreive it
from the appropriate cache and serve it back.

of course if you are writing the .css to disk then the handler isn't
necesarily required

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:us**************@TK2MSFTNGP04.phx.gbl...
"shapper" <md*****@gmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
I need to create the stylesheet at runtime.

Wow!
Anyway, do you know how to create the stylesheet at runtime?

Same way you would create any other text file:
http://aspalliance.com/152_How_to_Cr...le_in_ASP_NET_
And one more thing: what about adding the stylesheet, created at
runtime, to an existing CSS file?

Well, you'd have to open the existing CSS file, append the text from the
newly created CSS file into it, and save the existing CSS file.

Are you *really* sure you want to do this...?


Sep 22 '06 #6
"Edwin Knoppert" <ne**@hellobasic.comwrote in message
news:45**********************@text.nova.planet.nl. ..
control.style.add("thestyle","the value")

:)
The OP is trying to create an entirely new cascading stylesheet file, and
then merge it with an existing stylesheet file...

At least, that's what he says he's trying to do...
Sep 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jonathan | last post by:
At the moment I have 3 files: a small XML instance document, a schema (which the .xml validates against fine) and a work-in-progress .xsl. (posted below) The problem is that I cannot get the...
3
by: IMS.Rushikesh | last post by:
Hi Friends, I need a XPath query, whcih ll return me subset of data.... check below xml stream <label id="MyExpenseDetails_lbl" xlink:role="terseLabel">Short Expense Details</label> <label...
7
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element...
1
by: JezB | last post by:
How can I dynamically change an external stylesheet link (or import) at runtime in server-side code ? I don't want to use a placeholder as in <link id="myTheme" rel="stylesheet"...
7
by: Nathan Sokalski | last post by:
I have user controls that contain a link to a stylesheet. Several of my pages also have a link to this same stylesheet. Because of this, the resulting output contains multiple links to the same...
0
by: Emil Christopher Melar | last post by:
I wanted to use App_Theme, because then I might have some automation when it comes to not hard coding paths for the css. And as you know, you know that mozilla and IE renders differently, and...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
2
by: J055 | last post by:
Hi I'm adding rules dynamically to the HtmlHead.StyleSheet using the CreateStyleRule method. I'd like to know how to check whether the rules already exist first. Thanks Andrew
1
by: msarora | last post by:
I'm using SimpleTransform.java (renamed as ReceiptTransformer.java for custom use) found in xalan-j_2_7_0 samples directory for transformations in my custom application. The program compiles...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.