Umbraco and MVC

MVC, or, Model-View-Controller is an architectural pattern that’s been around since the 70’s that helps split your website code into three main layers, Model, View, and Controller. MVC is a big step up over traditional .NET web forms.  MVC pattern forces a separation of concerns within your website, that makes testing, maintaining and writing code easier.  MVC helps to separate your C# logic from you HTML, CSS and JS presentation code.

Umbraco allows you to build your website with either MVC or Webforms, even though web forms is so inferior companies are still using is..  if you are new to Umbraco then my advice is… DO NOT USE WEB FORMS FOR NEW PROJECTS!  Umbraco MVC can even be configured to work with ASP.NET Web Forms side by side and you can switch between them from request to request.  If you have inherited an old Umbraco website and you don’t want to start from scratch, you can slowly refactor it, into a more modern architecture.

The main difference between Umbraco MVC and traditional .NET MVC is that Umbraco adds some special hooks and routes into the MVC pipeline that allows it to render Umbraco virtual pages, instead of pages based on controllers and actions.   Umbraco MVC can be configured to work with standard MVC controllers and actions is you want it to, so it really is a very powerful platform that will allow you to do pretty much anything you can in a standard MVC website combined with the power of what Umbraco can deliver.


How To Create A Custom Template in Umbraco 7 with MVC

Previously, I wrote about 'Document Types' and how to create them in Umbraco, in How To Create A Document Type In Umbraco and create a page with it.  We can create containers that content editors can use to create a hierarchy of pages but, as of yet,[...]

How To Add Your Own Controller and View Model In Umbraco

In my last tutorial, we covered how to get data from Umbraco and display it in Umbraco.  If you are new to Umbraco and you haven't yet read the Umbraco Helper?  then I would head there first. In today's guide, I am going to explain how to create you[...]

How To Use MVC Partials In Umbraco

One of the main benefits of using MVC views is the ability to split functionality up in order to provide greater re-use.  In MVC, we can achieve this re-use by making use of partials.  If you come from a web forms background and you are still new to [...]

How To Create a Master Template In Umbraco?

When we create any new site, we don't want to have to duplicate the header, footer, includes to the stylesheets and javascript files on every page.  Instead, it is a much better approach to creating a global template that we can easily include in all[...]

How To Create A Global View Model For Your Umbraco Layout File

When working with MVC, it is best practice to work with strongly-typed Models to separate your presentation logic from your business logic.  I've talked previously about how to create models to represent document types, but that still leaves the prob[...]

How To Enable The Global.asax in Umbraco

If you have installed Umbraco via Nuget, it is likely that the sites global.asax might not be set-up correctly.  If you want to trigger some custom code on application start-up and your global.ascx is never being hit, then read on!  In today's guide,[...]

How To Create a Mega Menu in Umbraco 7

When we create very basic websites, the primary menu will very likely be made up from the child pages under the homepage.  When we want to create more advanced menus, then this limitation of needing a page to live in a certain area is very annoying. [...]

How To Create A Global View Model For Umbraco With uSitebuilder

I've previously talked in How To Create A Global View Model For Your Umbraco Layout File about the benefits of creating a global view model in your MVC Umbraco project to separate your presentation code from your business code. In the code sample I [...]

What Is An Umbraco Surface Controller?

Mastering Surface controllers will make your life easier when working with forms in Umbraco. I've written about route hijacking before within an Umbraco website. Route Hijacking, will tel your website how to route a virtual page request to your MVC[...]

How To Create A Paginated List In Umbraco

Displaying lists on a website is another requirement of almost every website, website search, blog posts, latest news, the list could go on and on. If you find yourself wanting to create a list in Umbraco and need some advice, then read on. Front-end[...]

How To Create A Search Page In Umbraco

Do you need to implement a site search within your Umbraco website? Then read on. Search is technically one of the pages on a lot of projects. A basic search is pretty easy to get started, but the further down the rabbit hole you get, the more compli[...]

How To Render Rich Text In Your Views When You Use Strongly Typed Models Within Umbraco

When you work with Umbraco, or in fact any MVC or.NET websites, I always recommend trying to work with strongly -typed models. In case you're fairly new to.NET and that statement confuses you, what I mean is that you should always work with C# classe[...]

Homepage Learn Umbraco CMS Umbraco Developers Guide Umbraco and MVC
Back to top