howto avoid to load all the stylesheet files in a theme?

Last post 09-11-2005 9:22 PM by jeffwids. 3 replies.

Sort Posts:

  • Confused [8-)] howto avoid to load all the stylesheet files in a theme?

    09-11-2005, 10:03 AM
    • Member
      225 point Member
    • hongtao
    • Member since 06-20-2002, 2:54 PM
    • Seattle,WA
    • Posts 45
    Having around 10 stylesheets files in the theme, but only about 2 or 3 (a basic stylesheet plus one or two additional style setting) used on one aspx page. How can I avoid the theme loading all the stylesheet files?

    Thanks
  • Re: howto avoid to load all the stylesheet files in a theme?

    09-11-2005, 1:07 PM
    • Contributor
      6,285 point Contributor
    • BrockAllen
    • Member since 05-05-2003, 2:46 PM
    • Providence, RI
    • Posts 1,253

    I see two ways to address this:

    1) Remove them at runtime. Access Page.Header and remove all the child controls that are HtmlLink that you don't want.

    2) Add them at runtime. Don't put them in the Themes directory, and instead add them as needed by creating HtmlLink controls and adding them  Page.Header.

    -Brock

    DevelopMentor
    http://staff.develop.com/ballen
  • Re: howto avoid to load all the stylesheet files in a theme?

    09-11-2005, 1:50 PM
    • Member
      225 point Member
    • hongtao
    • Member since 06-20-2002, 2:54 PM
    • Seattle,WA
    • Posts 45
    Thanks for your information. I have to say that the theme is still a junior feature.
  • Re: howto avoid to load all the stylesheet files in a theme?

    09-11-2005, 9:22 PM
    • Member
      497 point Member
    • jeffwids
    • Member since 06-11-2002, 7:08 AM
    • New Jersey
    • Posts 57
    • ASPInsiders
    It sounds like you have a fairly complicated site with multiple stylesheets
    per page and you have broken out the various css classnames into these
    stylesheets. The basic stylesheet probably does not change much (even if
    you were to apply a different theme to your site) so include this stylesheet
    as a regular link tag in your base master page. Then create different
    themes for each of the different pages that require a different set of
    stylesheets. For instance the themes might be named BlueThemePageType1 and
    BlueThemePageType2. In the basepage for PageType1 or PageType2 set the
    appropriate theme in the PreInit event and you are done.

    Themes and masterpages plus good old html all working together can provide a
    very dynamic and powerful system for you.
Page 1 of 1 (4 items)