I am using Telerik Winform RadMaskedEditBox 2011.3.11.1116. When using a MaskType "Numeric" and MaxLenght property set to 9 the MaxLenght does not work, it allows me to type more than 9 digits. I have a need to ensure only numerics are entered but at the same time limit that value to a max of 999999.99. I don't want the control filled with 00000000 when the position is not in use.
Doesn't seem you can use the two properties together.
Any ideas,
Regards,
Kerry
6 Answers, 1 is accepted
This is by design as far as I'm aware. In order to add a mask for only numeric digits (and only a certain number of them) you could do the following:
this
.radMaskedEditBox1.MaskType = MaskType.Standard;
this
.radMaskedEditBox1.Mask =
"0000"
;
This would ensure that the user can only type in 4 numeric digits.
The documentation for the mask editor can be found here and the subsections detail the types of masks and how to use them.
Hope this helps, but let me know if you need further assistance
Richard
Thank you for writing.
The MaxLength property is valid only for MaskType None. For other types of masks (Numeric for example), the Mask property has higher priority than MaxLength. For example Numeric Mask type and "n3" Mask means unlimited digits before decimal separator and 3 digits after it, while g means unlimited numbers.
Do not hesitate to contact us if you have other questions.
Peter
the Telerik team
My mask type is regex... for site..
I set maxLength to 250 (characters) but not working..
I insert lorem ipsum text with more than 250 chars the maxlength property do not trim the text
Its been a long time since I visited this however, I could not get both properties to work together, I opted to use MaxLength property which does not trim but stops the user from enter too many characters. I then used Javascript to validate that everything they entered was valid numeric with a RegEx
function numericOnly(inputtxt)
{
var reg = new RegExp('^[0-9]+(\.[0-9]+)?$');
if (reg.test(inputtxt))
return true;
else
return false;
}
Hope this helps
Thank you for writing.
Since Q1 2013 SP1 (version 2013.1.321) the MaxLength property is removed. The Mask property should be used instead to set the appropriate mask value. You can refer to the following stackOverflow thread which demonstrates a sample approach how to use a Regular Expression to limit the allowed number of characters: http://stackoverflow.com/questions/1649435/regular-expression-to-limit-number-of-characters-to-10 .
However, note that the user will be allowed to enter more symbols and when the RadMaskedEditBox is about to lose focus, it will try to validate its text and an error indicator will be displayed if the input does not match the Regex. You can specify the RadMaskedEditBox.MaskedEditBoxElement.TextBoxItem.MaxLength property in order to limit the user input.
I hope this information helps. Should you have further questions, I would be glad to help.
Dess
Telerik
See What's Next in App Development. Register for TelerikNEXT.
I know this is an old ticket, but this the closest I could find to what I am having an issue with. We are using RadMaskEditBox with Mask Type of "EMAIL". However, we need to limit the number of characters that can be entered, (due to database field size limitation). From what I am reading, this is not possible for this control. Is that the case, even after 7 years of updates? We are running the latest Tekerik for UI WinForms. Right now, we are using validation to let the user know they can not exceed a specified length, but I thought this control would work similar to the standard RadTextBoxControl.
TIA
RadMaskedEditBox internally hosts the standard MS TextBox. Hence, if you want to limit the number of entered characters, feel free to specify the MaskedEditBoxElement.TextBoxItem.MaxLength property:
this.radMaskedEditBox1.MaskType = MaskType.EMail;
this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.MaxLength = 7;
I hope this information helps.