Writing style sheet code from a sub

Discussion in 'ASP .Net' started by =?Utf-8?B?S2VubmV0aCBQ?=, Jan 17, 2005.

  1. 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
    =?Utf-8?B?S2VubmV0aCBQ?=, Jan 17, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?S2VubmV0aCBQ?=

    MWells Guest

    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" <> wrote in message
    news:...
    > 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
    MWells, Jan 18, 2005
    #2
    1. Advertising

  3. 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" <> wrote in message
    > news:...
    > > 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

    >
    >
    >
    =?Utf-8?B?S2VubmV0aCBQ?=, Jan 20, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roy
    Replies:
    1
    Views:
    370
    Curt_C [MVP]
    Aug 10, 2005
  2. Replies:
    0
    Views:
    784
  3. Replies:
    0
    Views:
    516
  4. Ben
    Replies:
    2
    Views:
    883
  5. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,021
    Lawrence D'Oliveiro
    May 20, 2011
Loading...

Share This Page