Skip to main content

MaskSettings.Mask Property

Gets or sets a mask expression.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web


public string Mask { get; set; }

Property Value

Type Default Description
String String.Empty

A string representing a mask expression.

Property Paths

You can access this nested property as listed below:

Object Type Path to Mask
.MaskSettings .Mask
.MaskSettings .Mask
.MaskSettings .Mask
.MaskSettings .Mask


Applying a mask to the editor restricts the text that end-users can enter. If masked mode is enabled, the editor validates the text against the mask, and only allows data that satisfies the mask expression to be entered. To enable masked mode for an editor, specify the mask using the Mask property.



  • Zip code

MaskSettings.Mask Property - Zip Code

<dx:ASPxTextBox ID="txtZip" runat="server">
    <MaskSettings Mask="00000" PromptChar="#" />
  • Phone Number

MaskSettings.Mask Property - Phone Number

<dx:ASPxTextBox ID="txtPhone" runat="server">
    <MaskSettings Mask="+1 (999) 000-0000" IncludeLiterals="None" />
  • Price

MaskSettings.Mask Property - Price

<dx:ASPxTextBox ID="txtPrice" runat="server" >
    <MaskSettings Mask="$<0..99999g>.<00..99>" IncludeLiterals="DecimalSymbol" />
  • Date

MaskSettings.Mask Property - Date

<dx:ASPxDateEdit ID="dateEdit" runat="server" EditFormat="Custom" 
UseMaskBehavior="true" EditFormatString="MMMM dd, yyyy" >
  • Promo Code

MaskSettings.Mask Property - Promo Code

<dx:ASPxTextBox ID="txtPromoCode" runat="server" >
    <MaskSettings ShowHints="true" Mask="<HOME|*BUSINESS>->aaaa-aaaa" />


@Html.DevExpress().TextBox(settings => {
    settings.Name = "textBox3";
    settings.Width = Unit.Percentage(100);
    settings.Properties.MaskSettings.Mask = "+1 (999) 000-0000";
    settings.Properties.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.None;
    settings.Properties.MaskSettings.ErrorText = "Invalid Phone Number";
    settings.Properties.ValidationSettings.Display = Display.Dynamic;


Online Demos

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Mask property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also