Asp.net mvc change homepage and .css dynamically

Is there a good way to change MasterPage and / or .css dynamically in asp.net mvc based on user preferences?

I understand that I can change the name of the wizard as follows:

return View("viewName", "master-name", oModel) 

and a view using different content contentPlaceHolder, perhaps, but which requires a change in each controller + action.

I should have suggested that there is a better way than this.

+4
source share
2 answers

I have a slightly simpler method:

 return View("View", getMasterName()); 

and in my main controller I have:

 protected string getMasterName() { return (Request.QueryString["tb"] == null) ? null : "Other_Master"; } 

I use it to display another template in the case of a thick vs vs popup window if, for example, javascript does not work and the controller boots without a thick window.

+3
source

All Articles