By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,067 Members | 1,849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,067 IT Pros & Developers. It's quick & easy.

Writing style sheet code from a sub

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
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

Nov 19 '05 #2

P: n/a
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

"MWells" wrote:
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
"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
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


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.