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

Change theme at runtime

1 Answer 61 Views
General Discussions
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 22 May 2012, 02:17 PM
I would like to offer my users the ability to choose their theme by letting them select from a drop-down. How do I accomplish this in MVC?
Thanks!

1 Answer, 1 is accepted

Sort by
0
jfkrueger
Top achievements
Rank 1
answered on 22 May 2012, 10:41 PM
Was able to do this fairly easily by using the asp.net profile. Also could have used the ViewBag.

@using ContosoUniversityTelerik.Models
@using Telerik.Web.Mvc.UI
@{var profile = new MyWebProfile( HttpContext.Current.Profile );}
 
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
 
@(Html.Telerik().StyleSheetRegistrar().
DefaultGroup(group => group.Add("telerik.common.css").
            Add( profile.Theme ).
    Combined(true).
    Compress(true)))
         
         
</head>

Now if I could just figure out how to get the UI working.... (apply change on combobox selection changed rather than a button) but I have another post for that. :-)











Tags
General Discussions
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
jfkrueger
Top achievements
Rank 1
Share this question
or