This is a migrated thread and some comments may be shown as answers.

Persist theme from example to the profile

2 Answers 20 Views
Documentation and tutorials
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 23 May 2012, 04:14 PM
Hello,

I have implemented the theme chooser that is used in the examples and it works great, however it doesn't persist the theme. IE if I go to another page it defaults back to Vista and if I change it and restart the site it goes back to the default of Vista. I would like to be able to persist the theme to the profile so that it can be loaded when the site is started and the propert theme will be selected from the drop-down. I have the profile working, I just need to know how to use the theme chooser from the examples so that it will persist and load the users theme from the profile.

Thoughts?

Thanks!

2 Answers, 1 is accepted

Sort by
0
jfkrueger
Top achievements
Rank 1
answered on 23 May 2012, 05:38 PM
Update: I have everything working as far as persisting the theme to the profile and setting the current theme from the profile. The only thing that isn't quite working is having the drop-down list have a selected value based on the profile.theme variable rather than relying on it always being in the querystring. How would I accomplish setting the selected item in the list based on the profile?

Thanks!
0
jfkrueger
Top achievements
Rank 1
answered on 23 May 2012, 06:00 PM
Got it! I simply needed to update the GetCurrentTheme(this HtmlHelper html){} method to the following:

public static string GetCurrentTheme(this HtmlHelper html)
{
    var theme = _Profile.Theme ?? "default";
 
    return html.ViewContext.HttpContext.Request.QueryString["theme"] ?? theme;
}

Now it works perfectly.
Tags
Documentation and tutorials
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
jfkrueger
Top achievements
Rank 1
Share this question
or