[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Expand]Common Concepts
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Pivot Grid
   Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Collapse]Data Editors
    Editor List
    Main Features
   [Collapse]Common Concepts
    [Expand]Binding Data Editors to Data
     Getting Editor Values
     Mask Editing
     Accessibility Support
    Filter Control
    Validation Summary
   [Expand]Strongly-Typed Editor Types
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Extensions
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Mask Editing

The DevExpress editors allow you to use masks during editing. Masks are useful when a string entered by an end-user into an editor matches a specific format. For instance, a text editor that accepts date/time values in the 24-hour format only, or only numeric values, or a phone number that only allows an end-user to enter digits into automatically constructed placeholders.

Within the MVC Editors components, masked input is supported by the following editor types.

  • Text box editors (in particular, the TextBox and ButtonEdit).

    Mask settings can be accessed via the TextBoxProperties.MaskSettings (ButtonEditProperties.MaskSettings) property. The editor's mask can be specified via the MaskSettings.Mask property.

    This example demonstrates how you can define mask editing settings for the TextBox MVC extension.

    The image below shows the result:

    View code (Razor):

  • Date editors (DateEdit).

    To enable masked input in a date editor, the DateEditProperties.UseMaskBehavior property should be set to true. The mask can be defined via the DateEditProperties.EditFormatString property, if the DateEditProperties.EditFormat property is set to EditFormat.Custom.

    This example demonstrates how you can define mask editing settings for the DateEdit MVC extension.

    The image below shows the result:

    View code (Razor):


Defining a text box editor's mask via the editor's MaskSettings.Mask property automatically activates the editor's built-in validation functionality. This might affect the editor's appearance, because some extra space might be occupied for an error image and text to be displayed for invalid input, which is due to an editor's default validation settings. To customize the editor appearance in this case, use validation properties available via the editor's ValidationSettings property (for instance, you can modify the ValidationSettings.Display or ValidationSettings.ErrorDisplayMode property, etc). You can also provide a mask-specific error text via the MaskSettings.ErrorText property of an editor.

Expanded Concepts

The following topics are available within the ASPxEditors Mask Editing section and describe mask editing concepts.

Is this topic helpful?​​​​​​​