Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • indula 2 posts 22 karma points
    Jan 12, 2010 @ 04:03
    indula
    0

    Switching templates on runtime code-behind

    Hi

    I would like to switch templates on a (same) page dynamically.

    My exact scenario is as below

    I am building a member portal and there is only one page with public access with login controls and some more dynamic user controls.

    Once the user logs in, I want to change the structure of the home page (the same page) by changing the template.

    Adding the template name to the url isnt really a solution for this scenario.

    Any ideas?

    Thanks

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 15, 2010 @ 16:54
    Dan Diplo
    0

    As far as I know there are two ways of doing this, but both involve changing the URL. You can add a query string parameter called altTemplate and set that to equal your template alias. Eg. if you had a template called newsAltView you could do this

    /page.aspx?altTemplate=newsAltView

    Or you can achieve the same thing via a 'friendly' URL:

    /page/newsAltView.aspx

     Another approach would be to change the master page via .NET

    See http://www.nibble.be/?p=42 and the comments, which have links to both methods.

     

Please Sign in or register to post replies

Write your reply to:

Draft