Tab

MaskSettings Class

Contains mask settings.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.2.dll

Declaration

public class MaskSettings :
    PropertiesBase

The following members accept/return MaskSettings objects:

Remarks

The MaskSettings class contains the settings that allow you to specify the input mask, error text, prompt char, and to define whether the literal characters of the mask are included in an editor’s value.

These settings can be accessed via the MaskSettings property of editor controls.

Example

  • Zip code

MaskSettings.Mask Property - Zip Code

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

MaskSettings.Mask Property - Phone Number

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

MaskSettings.Mask Property - Price

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

MaskSettings.Mask Property - Date

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

MaskSettings.Mask Property - Promo Code

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

MVC:

@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;
}).GetHtml()

Concepts

Online Demos

Implements

Inheritance

See Also