This project is read-only.

Text Box Building


This gets and sets the size of the textbox. Short for .Attr("size", int). There is also an overload for setting row and column size on a text area:

@Html.BuildTextbox("textarea-10-by-20").Multiline().Size(20, 10)




This extension adds the HTML5 pattern attribute (.Attr("pattern", string)), for regular expressions. For example, a text box that allows social security numbers could be written like this:




This extension adds the maxlength attribute (.Attr("maxlength", string))




This extension adds the minlength attribute (.Attr("minlength ", string))


.Min() and .Max()

These extension add the min and max attributes which are often used in conjunction with the HTML5 number input type.


This extension adds the HTML5 placeholder attribute (.Attr("placeholder", string)), which adds a watermark to the input field in supported browsers:

.Multiline() - Renders the output using TextAreaFor instead of TextBoxFor
.SingleLine() - This is the default behavior.  Only use this to switch the render mode back to SingleLine.
.Password() - Renders the output using PasswordFor instead of TextBoxFor

Last edited Aug 26, 2012 at 8:17 AM by grcodemonkey, version 8


No comments yet.