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.
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.