aspnet-8996-aspnet-mvc-extensions-data-editors-extensions-textbox.md
TextBox represents a single-line input control that allows end-users to enter text.
To learn more about TextBox and see it in action, refer to our online demos.
TextBox is realized by the TextBoxExtension class. Its instance can be accessed via the ExtensionsFactory.TextBox helper method, which is used to add a TextBox extension to a view. This method’s parameter provides access to the TextBox ‘s settings implemented by the TextBoxSettings class, allowing you to fully customize the extension.
TextBox ‘s client counterpart is represented by the ASPxClientTextBox object.
TextBox can be added to a view in the following manner.
View code (ASPX):
<%
Html.DevExpress().TextBox(
settings => {
settings.Name = "textBox1";
settings.Width = 170;
settings.Properties.DisplayFormatString = "[00 - 00 - 00]";
settings.Text = "123456";
}
)
.Render();
%>
View code (Razor):
@Html.DevExpress().TextBox(
settings => {
settings.Name = "textBox1";
settings.Width = 170;
settings.Properties.DisplayFormatString = "[00 - 00 - 00]";
settings.Text = "123456";
}).GetHtml()
Note
The Partial View should contain only the extension’s code.
The code result is demonstrated in the image below.
Data-Bound Mode
Native Rendering
Null Prompt Text
Masked Input
Display Formatting
Built-in Validation
Full-Featured Client-Side API