Writing style sheet code from a sub

G

Guest

Hi,

I'm developing asp.net (vb) apps in VS.NET 2003, and I'd like to know how
you can write style sheet code in a sub in an .aspx page that when it's
rendered as html/text/css code in the .aspx page.

The idea is to programmatically write style sheet code that dynamically goes
into every page and is rendered accordingly.

Let's assume I wanted this kind of code into my rendered .aspx page

----------------------------------------------
<style type="text/css">
<!--
A.white11b { font-family: verdana,geneva,arial,helvetica; font-weight:
BOLD; font-size: 11px; color: #FFFFFF; text-decoration: none;}
A.white11b:visited { font-family: . . . .
----------------------------------------------------
But that this code doesn't exist before it's rendered.

How would I do that?

TIA

Kenneth P
 
M

MWells

There are two approaches.

One is to use a System.Web.UI.HtmlControls.HtmlGenericControl; using this,
along with a unique ID and runat=server on your <style> tag, you should be
able to write the contents programmatically.

Another approach is to write an ASPX page that generates the contents of a
full CSS file, mimed as text/css. Link this into your regular pages to make
use of it. This is useful for programmatically generating CSS "skins" from
database content.

/// M
 
G

Guest

Hi M,
One is to use a System.Web.UI.HtmlControls.HtmlGenericControl; using this,
along with a unique ID and runat=server on your <style> tag, you should be
able to write the contents programmatically.

I've been using vs.net2002 & 2003 for about 4 years now, deployed a few
apps, butr I still lack experience of how to retrieve info about basic
classes in .net!

How can I in VS.NET 2003 see the methods and properties for
System.UI.HtmlControls.HtmlGenericControl?
Another approach is to write an ASPX page that generates the contents of a
full CSS file, mimed as text/css. Link this into your regular pages to make
use of it. This is useful for programmatically generating CSS "skins" from
database content.

A few questions on this.

The first sentence I understand, though I'm gonna need an example with code
on it.

The second sentence:
Hmmmm... Let me see. I think this is about sessions.
I should link it into my regular pages, you say. If there are many users
asking for the page at the same time, how will I resolve the conflict that
arises when I need to dynamically write a different .aspx file to each user
with css content? Or am I thinking wrong?

The third sentence:
I like the word "skins". That is absolutely the word I was thinking of when
I started to design my thoughts. But again, many users problem?

Regards,
Kenneth P
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top