Skip to main content
Tab

MaskSettings.IncludeLiterals Property

Gets or sets a value that specifies which constantly displayed mask characters (literals) are included in an editor’s value.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(MaskIncludeLiteralsMode.All)]
public MaskIncludeLiteralsMode IncludeLiterals { get; set; }

Property Value

Type Default Description
MaskIncludeLiteralsMode All

One of the MaskIncludeLiteralsMode enumeration values.

Available values:

Name Description
All

All literals are included in an editor’s value.

None

Literals are not included in an editor’s value.

DecimalSymbol

Only decimal symbol literals are included in an editor’s value.

Property Paths

You can access this nested property as listed below:

Object Type Path to IncludeLiterals
ASPxButtonEdit
.MaskSettings .IncludeLiterals
ASPxTextBox
.MaskSettings .IncludeLiterals
ButtonEditProperties
.MaskSettings .IncludeLiterals
TextBoxProperties
.MaskSettings .IncludeLiterals

Remarks

A mask expression specified via the MaskSettings.Mask property can consist of several parts. See the Mask Types topic to learn more. Use the IncludeLiterals property to control which kinds of literal symbols composing a mask should be included into an editor’s value.

If the IncludeLiterals property is set to MaskIncludeLiteralsMode.All (the default behavior), the edit value will store mask literal characters along with the data entered by an end-user. Placeholder symbols defined via the MaskSettings.PromptChar property are not included into an editor’s value for unfilled placeholders.

If the IncludeLiterals property is set to MaskIncludeLiteralsMode.None, only user input characters are stored in the edit value.

Set the IncludeLiterals property to MaskIncludeLiteralsMode.DecimalSymbol, to include culture dependant decimal symbols into an editor’s value.

Assume that the edit mask is “$<0..9999g>.99”, and an end-user enters the “2” symbol into the editor five times, as shown below:

MaskSettings_IncludeLiterals.png

The following table illustrates how setting the IncludeLiterals property affects the value of an editor.

The IncludeLiterals property’s value The editor’s value
All $2,222.2
DecimalSymbol 2222.2
None 22222

Examples

  • Zip code

TextBox - Zip Code

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

TextBox - Phone Number

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

TextBox - Price

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

TextBox - Date

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

TextBox - 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

See Also