HTML Helpers

HTML helpers are lightweight methods that execute on the server and return a string to be used as standard HTML on your page. They are accessed using @Html, which is essentially a property on your view. The HTML helper classes and related methods are found in the namespace Microsoft.AspNet.Mvc.Rendering.

These helper methods generate UI markup and should only be used on your pages (and not in the controller). Of course, you do not need to use HTML helpers. You can code all your view as actual HTML markup. In addition, many of the HTML Helpers have evolved into TagHelpers (see next section). However, these methods can simplify writing a lot of repetitive, basic HTML markup. The methods run on the server, but they are also lightweight. ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition 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.