ASP.NET MVC MaskedTextBox Overview

Telerik UI for ASP.NET MVC Ninja image

The MaskedTextBox is part of Telerik UI for ASP.NET MVC, a professional grade UI library with 110+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.

The Telerik UI MaskedTextBox HtmlHelper for ASP.NET MVC is a server-side wrapper for the Kendo UI MaskedTextBox widget.

The MaskedTextBox enables a controlled text input that is based on a specific format. The helper enables you to define its value and mask value, and set custom mask rules, prompt characters, and culture names. Each mask can contain mask rules and mask literals. The mask literals are automatically entered for the user and cannot be removed. You can also use the MaskedTextBox predefined rules which specify the required or optional digit, letter, or character input.

Basic Configuration

The following example demonstrates the basic configuration for the MaskedTextBox.

    @(Html.Kendo().MaskedTextBox()
        .Name("maskedtextbox") // The name of the MaskedTextBox is mandatory. It specifies the "id" attribute of the MaskedTextBox.
        .Mask("(000) 000-0000") // Set the mask value of the MaskedTextBox.
        .Value("(123) 345-6789") // Set the value of the MaskedTextBox.
    )

Functionality and Features

  • Mask rules—You can configure a variety of predefined masks as well as custom masks in the MaskedTextBox.
  • Globalization—The globalization process combines the translation of component messages (localization) with adapting them to specific cultures (internationalization and right-to-left support).
  • Accessibility—The MaskedTextBox is accessible by screen readers and provides WAI-ARIA, Section 508, WCAG 2.2, and keyboard support.

To learn more about the appearance, anatomy, and accessibility of the MaskedTextBox, visit the Progress Design System documentation—an information portal offering rich component usage guidelines, descriptions of the available style variables, and globalization support details.

Next Steps

See Also

In this article