Razor

Integrate Foundation Abide Validation with Razor HTML Helpers

March 10, 2015 by Chris Sherman

Razor HTML Helpers are convenient methods that return HTML strings representing different types of content. In this tutorial I’ll explain how to extend the Razor validation message helper so it integrates with Foundation’s Abide Validation library.

Continue reading

Razor Paging

February 25, 2015 by Chris Sherman

When you have large numbers of a particular object, it can be beneficial to add paging to limit the number of instances displayed. In this tutorial, I’ll demonstrate a Razor paging implementation that you can use with the Umbraco CMS as well as other projects that make use of Razor.

Continue reading

Save User Input to MongoDB with Umbraco

February 16, 2015 by Chris Sherman

There are many reasons why you may accept user input on an Umbraco CMS site, but what if you want to save that data to a document-oriented storage solution like MongoDB? In this article, I’ll explain how to add a surface controller that does just that in the context of a contact form. I will use MongoLab on Microsoft Azure as my database host, but you can also set up a local MongoDB server on your development machine.

Continue reading

Display Umbraco Tags on Razor Templates

February 12, 2015 by Chris Sherman

Umbraco has a built-in tag data type that allows users to easily apply a list of tags to a document. But once you’ve added a tag property to a document type, how do you display the tag list in a Razor view? I’ll show you how in three steps.

Continue reading

Navigate Between Child Documents in Umbraco

February 11, 2015 by Chris Sherman

It’s a common convenience to allow website visitors to navigate to the next document within a category without resorting to the back button. You might utilize this design paradigm at the bottom of a blog post to encourage your visitors to read another one of your articles. Lucky for us, Umbraco has a built-in extension function for doing just this sort of thing with the Razor syntax.

Continue reading

Umbraco Partial Views with Razor

February 4, 2015 by Chris Sherman

Partial Views encapsulate a piece of your view for reuse throughout your site. Using them can remove cumbersome logic from your primary templates while keeping your code DRY. Let’s start with a basic use case for partial views: getting the most recent children of a node.

Continue reading

Umbraco Dynamic Navigation Menu

January 5, 2015 by Chris Sherman

Content management systems like Umbraco deliver extensive website management capabilities without ever needing to touch the codebase. Choosing which pages appear in the navigation menu should be a configurable feature, so let’s implement it.

Continue reading

Query Umbraco Nodes with Different Document Types

December 30, 2014 by Chris Sherman

Querying for child content of Umbraco document types is a straightforward process on Razor templates that inherit from UmbracoTemplatePage, but querying for content from different document types is more opaque. Displaying content from areas throughout a website is common on views such as home pages, so in this tutorial I’ll show you how you can utilize Razor and XPath to grab content from disparate document types.

Continue reading