Ticket T852837
Visible to All Users

Devexpress textbox MaskSettings.Mask for digit with 2 decimal place is not working

created 5 years ago

I am using Html GridView and trying to setup a textbox with min value 0.00 and max value 2.00 (2 decimal places).
I use masksettings.Mask = "<0…2>.<0…9><0…9>" which works good with setting max value input to be 2.00, the only issue comes with you enter 1.0X ; X can be any digit from 1 to 9 it automatically converts to 1.X0. I wanted to know if this is a devexpress bug.

C#
settings.Columns.Add(column => { column.FieldName = "DigitTest"; column.Caption = "Test"; column.ColumnType = MVCxGridViewColumnType.TextBox; var textBoxProperties = column.PropertiesEdit as TextBoxProperties; textBoxProperties.DisplayFormatString = "{0:N2}";; // textBoxProperties.MaskSettings.Mask = "#.##"; // tried with this as well and doesn't work. textBoxProperties.MaskSettings.Mask = "<0..2>.<0..9><0..9>"; textBoxProperties.ValidationSettings.RegularExpression.ErrorText = "The number must be in the range of 0...2";

Answers approved by DevExpress Support

created 5 years ago

Hello,
You need to use the following mask:

Razor
textBoxProperties.MaskSettings.Mask = "<0..2>.<00..99>";

Please check mask settings for the "Price" editor in our online demo:
Masked Input

Let me know if it helps.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.