Changing theme by user

Last post 08-23-2005 3:31 PM by marcosb. 4 replies.

Sort Posts:

  • Changing theme by user

    08-23-2005, 10:09 AM
    • Member
      330 point Member
    • marcosb
    • Member since 06-20-2005, 8:50 AM
    • Uruguay
    • Posts 71

    A theme can be changed globally in the web.config, or locally in a page (declaratively or programatically).
    Can a theme can be changed globally for a specific user?
    What I want to have is different themes for different users.

    One way could be to put some code in the Page PreInit event based on a Session or Profile value of the user, but this should be performed in each page!
    There must be a simpler way.

    Thanks in advance.

  • Re: Changing theme by user

    08-23-2005, 1:28 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815
     marcosb wrote:
    One way could be to put some code in the Page PreInit event based on a Session or Profile value of the user, but this should be performed in each page!
    There must be a simpler way.

    and there is

    Create your own Page class inheriting from the System.Web.Page and add the PreInit event there

    When you create a new page on the site, go into the code behind and change from System.Web.Page to your class file...
    "If you make it idiot proof, they'll build a better idiot"
  • Re: Changing theme by user

    08-23-2005, 1:38 PM
    • Member
      330 point Member
    • marcosb
    • Member since 06-20-2005, 8:50 AM
    • Uruguay
    • Posts 71
    Thanks for answering.
    This is a good way to "simplify" but I have to change the inheritance hierarchy for each page I have in my site, and if possible, I would like to keep it.

    Anybody knows a better aproach, or a way to do it without changing each page?
  • Re: Changing theme by user

    08-23-2005, 3:23 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815
     marcosb wrote:
    but I have to change the inheritance hierarchy for each page I have in my site, and if possible

    yeah, it'd take 10 seconds

    "Edit" "Find and Replace"

    Look for:
    "Inherits System.Web.Page"
    Replace with:
    "Inherits MyCustomPageClass"

    done....  not sure how much simple it could get :)
    "If you make it idiot proof, they'll build a better idiot"
  • Re: Changing theme by user

    08-23-2005, 3:31 PM
    • Member
      330 point Member
    • marcosb
    • Member since 06-20-2005, 8:50 AM
    • Uruguay
    • Posts 71
    I think everybody knows this awesome feature called find and replace.
    I mean if there is an elegant solution.

Page 1 of 1 (5 items)