Skip to main content

TextBoxFor

TextBoxFor represents a single-line input control that allows end-users to enter text.

Implementation Details

TextBoxFor is realized by the TextBoxExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.TextBoxFor<ValueType> helper method, which is used to add a TextBoxFor extension to a view. This first method’s parameter is an expression that identifies model property to display and edit. The second method’s parameter provides access to the TextBoxFor‘s settings implemented by the TextBoxSettings class, allowing you to fully customize the extension.

TextBoxFor‘s client counterpart is represented by the ASPxClientTextBox object.

Declaration

TextBoxFor can be added to a view in the following manner.

@Html.DevExpress().TextBoxFor( model => model.PhoneNumber,
    settings => {
        settings.Width = 170;
        settings.Properties.DisplayFormatString = "[ 00 - 00 - 00 ]";
    }).GetHtml()

The code result is demonstrated in the image below.

textbox-declaration.png

See Also