Mask
- 2 minutes to read
DevExpress editors allow you to use masks when users edit data. Masks are useful when you require a user to enter a string in a specific format. For instance, a text editor that accepts date/time values in the 24-hour format only, or a phone number that requires a user to enter digits into automatically constructed placeholders.
You can use masked input in the following ASP.NET editor types (ASPxEditors):
Text box editors (in particular, the ASPxTextBox and ASPxButtonEdit).
You can use the ASPxTextBox.MaskSettings (ASPxButtonEdit.MaskSettings) property to access mask settings. Use the MaskSettings.Mask property to specify the editor’s mask.
<dx:ASPxTextBox ID="textBox" > <MaskSettings Mask="00000" ErrorText="Please input missing digits" /> </dx:ASPxTextBox>
Date editors (ASPxDateEdit).
Set the ASPxDateEdit.UseMaskBehavior property to
true
to enable masked input in a date editor. You can use the ASPxDateEdit.EditFormatString property to define the mask, if the ASPxDateEdit.EditFormat property is set to EditFormat.Custom.<dx:ASPxDateEdit ID="dateEdit" EditFormat="Custom" EditFormatString="MMMM dd, yyyy" UseMaskBehavior="true" > ... </dx:ASPxDateEdit>
Note
If you use the editor’s Mask