Telerik Forums RSShttp://www.telerik.com/urn:uuid:27e1366e-9cd7-4d4c-becd-2e2e4a91465dhttp://www.telerik.com/forums/permalink/bjbhJ9ecTE2-zS4uSpFGXQCannot use MaxLength and MaskType togetherHello,<br />
<br />
Thank you for writing.<br />
<br />
Since <em><a href="http://www.telerik.com/support/whats-new/winforms/release-history/q1-2013-sp1-version-2013-1-321" target="_blank">Q1 2013 SP1 (version 2013.1.321)</a></em> the <strong>MaxLength </strong>property is removed. The <strong>Mask </strong>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: <a href="http://stackoverflow.com/questions/1649435/regular-expression-to-limit-number-of-characters-to-10" target="_blank">http://stackoverflow.com/questions/1649435/regular-expression-to-limit-number-of-characters-to-10</a> .&nbsp;<br />
<br />
However, note that the user will be allowed to enter more symbols and when the <strong>RadMaskedEditBox </strong>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.<strong>MaxLength </strong>property in order to limit the user input.<br />
<br />
I hope this information helps. Should you have further questions, I would be glad to help.<br />
<div>&nbsp;</div>
Regards,<br />
Dess <br />
Telerik
<div class="forumBaloonTop">&nbsp;</div>
<div class="forumBaloon">
<p>See What's Next in App Development. <a title="Register for TelerikNEXT" target="_blank" href="http://www.teleriknext.com/">Register for TelerikNEXT</a>.</p>
</div>
<div class="forumBaloonBottom">&nbsp;</div>urn:uuid:b6649192-4262-4571-b1af-9a402fd1a92ehttp://www.telerik.com/forums/permalink/kpFktmJCcUWxr5pAL9GpLgCannot use MaxLength and MaskType together<p>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</p>
<p>
<div class="reCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;">
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #000000;">function numericOnly(inputtxt)</code></span></div>
<div style="background-color: #f8f8f8;"><span style="margin-left: 0px !important;"><code style="color: #000000;">{ </code></span></div>
<div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px !important;"><code style="color: #000000;">var reg = new RegExp('^[0-9]+(\.[0-9]+)?$');</code></span></span></div>
<div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px !important;"><code style="color: #000000;">if (reg.test(inputtxt))</code></span></span></div>
<div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px !important;"><code style="color: #000000;">return true;</code></span></span></div>
<div style="background-color: #f8f8f8;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 12px !important;"><code style="color: #000000;">else</code></span></span></div>
<div style="background-color: #ffffff;"><span><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><span style="margin-left: 24px !important;"><code style="color: #000000;">return false;</code></span></span></div>
<div style="background-color: #f8f8f8;"><span style="margin-left: 0px !important;"><code style="color: #000000;">}</code></span></div>
</div>
&nbsp;</p>
<p>Hope this helps</p>urn:uuid:b93e6037-b323-45b4-b1b6-e8b2bbf66550http://www.telerik.com/forums/permalink/N2A-uSOztEWxtuiyu_ZlUACannot use MaxLength and MaskType togetherplease help me..urn:uuid:84542fee-635b-4539-a044-7ebcc6d5c716http://www.telerik.com/forums/permalink/7i9UhFtjOUWgRH68xtXHFgCannot use MaxLength and MaskType together<p>My mask type is regex... for site..</p>
<p>I set maxLength to 250 (characters) but not working..</p>
<p>I insert lorem ipsum text with more than 250 chars the maxlength property do not trim the text</p>urn:uuid:85d5e534-1c2c-4f73-ba94-c4832a5f497dhttp://www.telerik.com/forums/permalink/NOXVhSwcc0-6lMSDKl9JfQCannot use MaxLength and MaskType togetherHi Kerry,
<p>Thank you for writing.<br />
<br />
The <em>MaxLength </em>property is valid only for <em>MaskType </em>None. For other types of masks (<em>Numeric </em>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.<br />
<br />
Do not hesitate to contact us if you have other questions.</p>
Regards,<br />
Peter <br />
the Telerik team
<div class="forumBaloonTop"></div>
<div class="forumBaloon"><strong>
RadControls for WinForms Q1'12 release is now live</strong>! Check out <a href="http://tv.telerik.com/watch/reporting/whats-new-in-q1-2012-radcontrols-for-winforms-reporting">what's new</a> or <a href="http://www.telerik.com/download-trial-file.aspx?pid=523">download a free trial &gt;&gt;</a>
</div>
<div class="forumBaloonBottom"></div>urn:uuid:7b492010-d2bb-4925-a155-1aad94a57f80http://www.telerik.com/forums/permalink/ECBJe7vSJUmhVRqtlKV_gACannot use MaxLength and MaskType togetherHi Kerry,&nbsp;<br />
<br />
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:&nbsp;<br />
<br />
<div class="tFormatCodeBlock supportThreadCodeBlock" style="border:1px solid #7f9db9;border-image: initial; overflow-y: auto;" id="highlighter_63794">
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.radMaskedEditBox1.MaskType = MaskType.Standard;</code></span></div>
<div style="background-color: #f8f8f8;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">this</code><code style="color: #000000;">.radMaskedEditBox1.Mask = </code><code style="color: blue;">"0000"</code><code style="color: #000000;">;</code></span></div>
</div>
<br />
This would ensure that the user can only type in 4 numeric digits.&nbsp;<br />
<br />
The documentation for the mask editor can be found&nbsp;<a href="http://www.telerik.com/help/winforms/editors-maskededitbox-overview.html" target="_blank">here</a>&nbsp;and the subsections detail the types of masks and how to use them.&nbsp;<br />
<br />
Hope this helps, but let me know if you need further assistance<br />
Richardurn:uuid:9285bb8d-5ec8-4c92-aa74-9baf1a6ce5fbhttp://www.telerik.com/forums/permalink/jbuFkshekkyqdJuvGmzl-wCannot use MaxLength and MaskType togetherHello,<br />
<br />
I am using Telerik Winform RadMaskedEditBox&nbsp;2011.3.11.1116. &nbsp;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. &nbsp;I have a need to ensure only numerics are entered but at the same time limit that value to a max of 999999.99. &nbsp;I don't want the control filled with 00000000 when the position is not in use.<br />
<br />
Doesn't seem you can use the two properties together.<br />
<br />
Any ideas,<br />
<br />
Regards,<br />
<br />
Kerry