Using the Built-in Helper Methods

Now that we have seen how helper methods work, we can look at the built-in helpers that the MVC framework provides. We have already encountered some of these helpers in earlier examples, but this is the part of the book where we can look at them in depth.

images Note The built-in helpers automatically encode data values to make them safe to display in a browser.

Creating Forms

One of the most frequently used helper methods is Html.BeginForm, which lets us create an HTML form element. This helper is used in a special way, as shown in Listing 26-4.

Listing 26-4. Using the Html.BeginForm helper

@using (Html.BeginForm()) ...

Get Applied ASP.NET 4 in Context now with O’Reilly online learning.

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