-
Book Overview & Buying
-
Table Of Contents
Bootstrap for ASP.NET MVC - Second Edition
By :
An HtmlHelper is a method that renders HTML content inside a view. It is intended to allow developers to reuse a common block of HTML markup across multiple pages.
ASP.NET MVC provides a range of standard, out-of-the-box HTML Helpers. For example, to produce the HTML for a textbox with an ID and name attribute of CustomerName, use the following code:
<input type="text" name="CustomerName" id="CustomerName">
You should use the TextBox helper as illustrated:
@Html.TextBox("CustomerName")
The majority of the built-in HTML Helpers offer several overloaded versions. For instance, to create a textbox and explicitly set its name and value attributes, you should use the following overloaded TextBox helper method:
@Html.TextBox("CustomerName"","Northwind Traders")
Most built-in helpers also offer the option to specify HTML attributes for the element that is generated by passing in an anonymous type. In the...
Change the font size
Change margin width
Change background colour