26.06.2017 Views

Bootstrap for ASP.NET MVC

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Making Things Easier with the Twitter<strong>Bootstrap</strong><strong>MVC</strong> Library<br />

Forms and inputs<br />

Twitter<strong>Bootstrap</strong><strong>MVC</strong> offers luent helpers <strong>for</strong> most <strong>for</strong>ms and input elements.<br />

Inputs<br />

Twitter<strong>Bootstrap</strong><strong>MVC</strong> supplies <strong>ASP</strong>.<strong>NET</strong> <strong>MVC</strong> helpers <strong>for</strong> all HTML input<br />

elements; most of these components share the same chaining methods. These<br />

methods are listed in the following table:<br />

Method name<br />

.Label()<br />

.Tooltip()<br />

.HelpText()<br />

.Id()<br />

.Class()<br />

.ReadOnly()<br />

.HtmlAttributes()<br />

.Data()<br />

.Disabled()<br />

.DisabledDependsOn()<br />

.VisibleDependsOn()<br />

Description<br />

This prepends a label element to the element<br />

This adds a tooltip to the component with the<br />

supplied message<br />

This adds a helper text next to the element<br />

This sets the id attribute of the element<br />

This sets the class HTML attribute of<br />

the element<br />

This adds readonly="readonly" to<br />

the element<br />

This adds the specified HTML attribute(s)<br />

to the element<br />

This works in a similar fashion as the<br />

.HtmlAttributes() method but prepends<br />

data- to the attribute<br />

This adds disabled="disabled" to<br />

the element<br />

This disables an element that is conditionally<br />

based on the value of another element<br />

This hides an element that is conditionally based<br />

on the value of another element<br />

.ShowValidationMessage() This sets whether the validation message should<br />

be shown <strong>for</strong> an element in case its validation fails<br />

[ 162 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!