Back to Devexpress

MaskSettings Class

aspnet-devexpress-dot-web-8b55ba57.md

latest3.8 KB
Original Source

MaskSettings Class

Contains mask settings.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class MaskSettings :
    PropertiesBase
vb
Public Class MaskSettings
    Inherits PropertiesBase

The following members 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

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

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

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

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

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

MVC:

csharp
@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

IStateManager

Inheritance

Object StateManager PropertiesBase MaskSettings

See Also

MaskSettings Members

DevExpress.Web Namespace