So I've downloaded some CSS templates to help make my website look nicer. I have an MVC 3 project for my final year of study, and I don't want it to look like the same generic MVC layout that everyone is using. Is it possible to easily integrate a template or are there special MVC templates out there?
Is it possible to easily integrate a template ?
Yes, surely. Just change the code in views with respective HTML. You can see this video for more details.
Related
So I am trying to change the CSS up in MVC 5 from the default bootstrap view that it renders. In some examples I have seen from MVC 4 which didn't use bootstrap by default I don't believe, it has a much better looking template in my opinion. MVC 5 has the plain black bar across the top, I know MVC 4 is also simple but I prefer that one. The only problem is I can't seem to find the source code, or the original CSS files they used for it anywhere? Every tutorial that I can find simply uses images instead of providing the files that I would need to add it to my project.
Here is the look I am going for...
http://i1.asp.net/media/45041/mvc4-restyled-templates.png?raw=true&cdn_id=2014-05-05-001
The default look that MVC 5 using bootstrap provides is..
http://eduardopires.net.br/wp-content/uploads/2013/07/aspnet_mvc5_build.jpg
Any suggestions on how I might switch to the previous version, or where I might find the proper CSS files to change it? I am trying to do this to an existing project so starting over really isn't an option. Thanks ahead of time.
You can install MVC4 side by side with MVC5 and create web project with MVC4 template. From there you can obtain the css you're looking
I have an ASP.NET 3 MVC site with areas. The structure is like this:
Areas
Products
Views
Advanced Search
Detail
Great Products
Views
Advanced Search
Detail
Currently I can access this:
www.domain.com/Products/AdvancedSearch
www.domain.com/GreatProducts/Detail
Now we need to internationalise the routing. I want to achieve this:
[English]
www.domain.com/Products/AdvancedSearch
www.domain.com/GreatProducts/Detail
[Portuguese]
www.domain.com/Produtos/PesquisaAvancada
www.domain.com/GrandesProdutos/Detalhe
I was able to follow this great article:
but currently does not support areas.
Can areas support localization? Can you give me some hint to solve this issue?
Thanks.
You will have to dig into the routing and use localization at that label to get the desired functionality.
See ASP.NET MVC - Localization route
It looks like you create a new controller for each language. We can do that like
[English]
www.domain.com/en/Products/AdvancedSearch
www.domain.com/en/GreatProducts/Detail
[Portuguese]
www.domain.com/por/Produtos/PesquisaAvancada
www.domain.com/por/GrandesProdutos/Detalhe
So I think we can be easier to modify the View Engine to localisation.
I am building a website, and want to do it using MVC 4. I dont want to use the custom asp.net template, and the asp.net templates available online do not meet my requirements. I have designed a html-css template and need to incorporate it into my project...(pretty much build the "contents folder" of the default templated mvc 4 project myself, if u know what i mean)...
I would really appreciate if someone points me to a tutorial or gives me a step-by-step account of how to do it.
You're pretty much looking for how to use Layouts and Sections with Razor. You can have as many as you'd like.
If I'm understanding correctly, you simply want to apply your template to _Layout.cshtml. This is similar in purpose to a MasterPage in ASP.NET web forms.
Here's a ScottGu blog on layouts and sections. (Just noticed that's the same link provided by #ErikPhilips)
To provide a simple explanation. _Layout.cshtml resides at Project\Views\Shared\_Layout.cshtml. By default it looks like a normal HTML file with a couple of unusual lines. The most important being #RenderBody(). When returning a ViewResult from an action (e.g. return View("MyView, myModel)), your view gets rendered by #RenderBody inside the layout. You can do what you like with _Layout.cshtml and if you're brave, you can also nest layouts.
I think visual studio is wysiwyg like editor so do I need to learn programming?
Yes, you need to if you need to add dynamic functionality to your asp.net website.
WYSIWYG if just in terms of visual, like dropping Buttons and layout of the form. For functionality, you are required to code in either C# or VB.net
Unless you just want to design a set of static pages, then yes.
You might want to take a look at Lightswitch:
http://www.microsoft.com/visualstudio/en-us/lightswitch
It depends what you mean by "website".
For anything more complex than some static pages you're going to need to learn some kind of programming.
Even with a basic site you'll want to learn CSS and HTML. The code produced by any WYSIWYG is rarely up to standard.
Yes, you need to learn programming, in some form or the other. If you're just looking to create some static HTML pages, you should probably look into something like Dreamweaver instead of Visual Studio. The learning curve with Dreamweaver isn't as steep.
Recently, I was working with PHP.
In PHP we have a powerful template engine like Smarty.
Do we have something like Smarty in ASP.NET ?
Quick google search :
Try one of these :)
http://csharp-source.net/open-source/template-engines
Well, you could argue that all ASP.NET webform pages are similar to templates, as they don't need to (and usually don't) have any application logic within the .aspx pages (it all goes in the codebehind). However, you might find that ASP.NET MVC is even more like what you are familiar with. ASP.NET MVC supports a number of view engines, too.
Have you tried Dotliquid?
It's old but still working great with webforms. You can even have User Controls loaded dynamically that use Dotliquid templates to present data from a database or a webapi, giving you the possibility to change the presentation layer by only editing html mixed with Liquid Language (not fully covered).
Check it out at http://dotliquidmarkup.org/try-online
Liquid Documentation at https://shopify.github.io/liquid/