473,396 Members | 1,784 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,396 software developers and data experts.

dynamic css file

what would be the easiest way to create a dynamic css file to link to eg

....
<head>
<link type="text/css" rel="Stylesheet" href="lis.aspx" />
</head>
....
this one quite clumsy since it's creating a whole Page class to simply
create dynamical output (text file)?
Jun 29 '06 #1
3 4585
I think you should use handler's files - .ashx
I think, you will find all necessary info in MSDN and, also, at
codeproject.com
Daves wrote:
what would be the easiest way to create a dynamic css file to link to eg

...
<head>
<link type="text/css" rel="Stylesheet" href="lis.aspx" />
</head>
...
this one quite clumsy since it's creating a whole Page class to simply
create dynamical output (text file)?


Jun 29 '06 #2
I've done my Googling and searching also now on Codeproject - can please
someone help me finding articles or at least give me the correct keywords
for Google?

<al**************@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
I think you should use handler's files - .ashx
I think, you will find all necessary info in MSDN and, also, at
codeproject.com
Daves wrote:
what would be the easiest way to create a dynamic css file to link to eg

...
<head>
<link type="text/css" rel="Stylesheet" href="lis.aspx" />
</head>
...
this one quite clumsy since it's creating a whole Page class to simply
create dynamical output (text file)?

Jun 29 '06 #3
My understanding about your problem is, you want to get the CSS
attributes dynamically using a Server call, rather than just placing the
CSS file in the LINK tag.

If it is right, then look at the below code, the code is for an custom
control which placess <style> tag in the page and reads the CSS file and
writes the CSS tags inside the <style> tag.

...

public class CssWriter : WebControl
{
public CssWriter : base (HtmlTextWriterTag.Style)
{}

void Render(HtmlTextWriter writer)
{
TextReader reader
= new FileStream(this.Server.MapPath("cssfile.css" ...

writer.Write(reader.ReadToEnd());
}
}
...
....

As i mentioned before this code reads the CSS file and places the
content into the Writer object, which inturns writes the CSS tags in the
page. Though I mentioned <style> as a the html tag should be used by the
control thru the constructor atlast, the page will result in writing the
Css tags inside the <style> tag.

If you place this control inside the .aspx file

...
<head>
<cc1:CssWriter id="csw1" runat="server"></cc1:CssWriter>
</head>
...

and look at the View Source from browser, you can see the Css tags are
written inside the <style> tag.

This is pretty straightforward way and efficient as well. But, you
should know little bit about Custom Control development in ASP.NET
for implementing this code properly.

Let me know if this doesn't solves your problem.

--
Vadivel Kumar
http://www.vadivelk.net
va**@online.vadivelk.net (remove "online.")

Daves wrote:
what would be the easiest way to create a dynamic css file to link to eg

...
<head>
<link type="text/css" rel="Stylesheet" href="lis.aspx" />
</head>
...
this one quite clumsy since it's creating a whole Page class to simply
create dynamical output (text file)?

Jun 29 '06 #4

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

Similar topics

6
by: bry | last post by:
Hi, I'm trying to do a dynamic import of a file that has no problems with it, that is to say I can import it normally, my sys.path is set to the right folder etc. but my dynamic import code is not...
4
by: Daniel Keller | last post by:
Hello! I'm trying to set up a page system using "dynamic" SSI. That means that I normally use the following on my website: <!--#include virtual="file.inc" --> Now I want to make this...
5
by: meyousikmann | last post by:
I am having a little trouble with dynamic memory allocation. I am trying to read a text file and put the contents into a dynamic array. I know I can use vectors to make this easier, but it has to...
3
by: K.S.Liang | last post by:
Hi all, 1> If there are more than one dynamic linking libraries in the file system, how do I know which one is loaded into system? Any C library or system call can tell me which *.so or *.sl is...
6
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
2
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of...
5
by: pittendrigh | last post by:
There must be millions of dynamically generated html pages out there now, built by on-the-fly php code (and jsp, perl cgi, asp, etc). Programatic page generation is transparently useful. But...
7
by: Ajinkya | last post by:
I have writen a program for a game called game.exe Now it includes a player part to which has to be a function to be writen by someone else. Now I want to provide this exe to some tester who...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.