Chapter 5

Forms and HTML Helpers

— By K. Scott Allen

What's In This Chapter?

  • Understanding forms
  • How to make HTML helpers work for you
  • Editing and inputting helpers
  • Displaying and rendering helpers

HTML helpers, as their name implies, help you work with HTML. Because it seems like a simple task to type HTML elements into a text editor, you might wonder why you need any help with your HTML. Tag names are the easy part, however. The hard part of working with HTML is making sure the URLs inside of links point to the correct locations, form elements have the proper names and values for model binding, and that other elements display the appropriate errors when model binding fails.

Tying all these pieces together requires more than just HTML markup. It also requires some coordination between a view and the runtime. In this chapter, you see how easy it is to establish the coordination. Before you begin working with helpers, however, you first learn about forms. Forms are where most of the hard work happens inside an application, and forms are where you need to use HTML helpers the most.

Get Professional ASP.NET MVC 3 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.