Add Css File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Add Css File

    Hello,

    I am adding, in a page, a reference to a CSS file at runtime as
    follows:

    Dim base As HtmlGenericCont rol = New HtmlGenericCont rol("style")
    With base
    .Attributes.Add ("type", "text/css")
    .Attributes.Add ("media", "Screen")
    .InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
    End With
    Page.Header.Con trols.Add(base)

    In which Page Event should I do this?

    Thanks,

    Miguel
  • nick chan

    #2
    Re: Add Css File

    Init, page load or page complete . ur choice
    On Apr 16, 8:51 am, shapper <mdmo...@gmail. comwrote:
    Hello,
    >
    I am adding, in a page, a reference to a CSS file at runtime as
    follows:
    >
        Dim base As HtmlGenericCont rol = New HtmlGenericCont rol("style")
        With base
          .Attributes.Add ("type", "text/css")
          .Attributes.Add ("media", "Screen")
          .InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
        End With
        Page.Header.Con trols.Add(base)
    >
    In which Page Event should I do this?
    >
    Thanks,
    >
    Miguel

    Comment

    • Cowboy \(Gregory A. Beamer\)

      #3
      Re: Add Css File

      This one is pretty wide open, as far as events, but why do this at all.

      A better option, in many cases, is to set up themes. You can then use your
      base class (from another thread) and set the theme there. Then you do not
      end up creating dynamic links to CSS pages, which are harder to control.

      --
      Gregory A. Beamer
      MVP, MCP: +I, SE, SD, DBA

      Subscribe to my blog


      or just read it:


      *************** *************** *************** ****
      | Think outside the box!
      |
      *************** *************** *************** ****
      "shapper" <mdmoura@gmail. comwrote in message
      news:f770d4a2-4f34-4d5e-a3d9-9cefbbbb9a16@8g 2000hse.googleg roups.com...
      Hello,
      >
      I am adding, in a page, a reference to a CSS file at runtime as
      follows:
      >
      Dim base As HtmlGenericCont rol = New HtmlGenericCont rol("style")
      With base
      .Attributes.Add ("type", "text/css")
      .Attributes.Add ("media", "Screen")
      .InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
      End With
      Page.Header.Con trols.Add(base)
      >
      In which Page Event should I do this?
      >
      Thanks,
      >
      Miguel

      Comment

      Working...