+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to change Theme at runtime without Login

How to change Theme at runtime without Login

3 posts, 0 answered
  1. saqib
    saqib avatar
    22 posts
    Registered:
    23 Nov 2007
    01 Feb 2011
    Link to this post
    Hi ,

    User want to change theme of page at runtime without login. Currently following function is available to change the page theme at  runtime but it works only if user is login.

      var manager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
                SiteMapNode currentNode = Telerik.Sitefinity.Web.SiteMapBase.GetCurrentProvider().CurrentNode;
                Guid pageId = ((PageSiteNode)currentNode).PageId;
                var draft = manager.EditPage(pageId, true);
                draft.Theme = DropDownList1.SelectedValue;
                manager.PublishPageDraft(draft.Id, true);
                manager.SaveChanges();
                SiteMapBase.Cache.Flush();
                Response.Redirect(currentNode.Url);

    But i want to change the page theme without login. i am using sitefinity 4.0. Please guide me in detail because there is no much help is available for SiteAffinity4.0.

    thanks
    Saqi
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Feb 2011
    Link to this post
    Hi saqib,

    I believe that you are talking about Sitefinity 4.0, so I suggest that you should check  Set page theme at runtime

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. saqib
    saqib avatar
    22 posts
    Registered:
    23 Nov 2007
    01 Feb 2011
    Link to this post
    Hi,
    I have read already this but i need different.

    I have dropdown on website and on selection of that i need to change theme of page.
    But it should not save in database it should be save in session or cookie. For this i need to override pre_init method. i dont know how to override it in sitefinity4.

    Please guide me or give me your though how to handle theme change.
    thanks
    saqib
Register for webinar
3 posts, 0 answered