I have a ASP.Net 2.0 site and want to translate it into MVC paradigm (I'm new to this), but starting from Zero.
I have some themes in my old site, but reading here and there, it seems like Themes doesn't fit well into MVC paradigm.
The question is:
What is the best practice in MVC for building a Themed user customizable site? Can you give a little example, if applicable?
Note: I'm aware of this but they don't talk about best practices or how to start with.
Themes can be applied by using either the Theme or StyleSheetTheme attribute of the @ Page directive, or by setting the pages Element (ASP.NET Settings Schema) element in the application configuration file. Visual Web Developer will only visually represent themes applied by using the StyleSheetTheme attribute.
Type grunt swatch:[theme] to build the CSS for a theme, e.g., grunt swatch:flatly for Flatly. Or type grunt swatch to build them all at once. You can run grunt to start a server, watch for any changes to the SASS files, and automatically build a theme and reload it on change.
Installing Bootstrap Bundle This plugin can be downloaded from Visual Studio itself. Just go to Tools, then Extensions and Updates > Online and search for Bootstrap Bundle. Select the plug-in and hit download then install.
The topics which I have covered in this tutorial are Controller, View, Routing, Data Sharing from view to controller and controller to view, Razor, HTML Helper Class, Model, Validation, Master Page, Partial View, scaffolding , ajax,area , Authentication, web api etc with example.
Here's my code that I've been using for implementing "Themes" in ASP.NET MVC:
ASP.NET MVC: Implement Theme Folders using a Custom ViewEngine
It's nice when you're able to just swap out CSS files to change the theme, but this really isn't very practical in a ton of cases. Especially when each theme needs to have a completely different layout. In which case, you need to change the CSS and HTML that gets rendered, and this is why I wrote the code found at the above link.
A clean, semantically correct HTML with a good CSS is the way to theme any web app, whether it's ASP.NET, RoR, PHP, etc.
The best example of the power of CSS is CSS Zen Garden.
w3schools has a nice introduction/tutorial to CSS.
Each of your users could have an associated stylesheet which would get selected whenever applicable, i.e.:
<link rel="stylesheet" type="text/css" href="<%= Model.SelectedStyleSheet %>"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With