O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Centralized formatting of common types with templated helpers

In the previous chapter, we saw how you can use HTML helpers for different input types. Additionally, ASP.NET MVC provides intuitive helpers such as EditiorForModel, which try to figure out which input types you actually want to use. Helpers such as EditorForModel make these assumptions primarily based on data type, but what if there were a data type that was unaccounted for? In this recipe, we will take a look at how we can override these decisions to centralize the formatting of common types. We will do this by using the built-in templated helpers. Templated helpers allow you to specify how you want to display common types, such as dates and numbers, as well as more complex models. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required