This is a migrated thread and some comments may be shown as answers.

how to allow zeros on the left side of number

1 Answer 304 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Marco Teodoro
Top achievements
Rank 1
Marco Teodoro asked on 25 May 2011, 04:33 PM
Hello i'm trying to use maskedinput numeric but i'm not able to use it correctly.

I need to have a number with the exact lenght of 21 digits but if i my some of my digits are 0 and are placeded in the left part of the number they are beeing ignored.

how can i have this value (000700150040000000672)  validated.

i dont want to use masked textbox because of is annoying behaviour - must start writing from left to right.... or is possible to start write whatever i want? if so, i'm sorry for the criticism... 

sorry if this makes sense to you but does't make any sense to me or my clients... why should i start to write from left?

can you give an example of how to work with percentages only allowing to decimal digits and a dot as separator? 


Best Regards, Marco

 

1 Answer, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 30 May 2011, 04:00 PM
Hi Marco Teodoro,

The leading zeros are being removed, as when the text is parsed by the control, they are not taken into consideration as they do not have effect on the value itself. What you can do is set the UpdateValueEvent to LostFocus:

<telerik:RadMaskedNumericInput UpdateValueEvent="LostFocus" 
             Mask="#21" Value="{x:Null}" 
             AllowSkipPlaceholders="True" 
             AutoFillNumberGroupSeparators="False"
             AutoFillZeros="False"
             SelectionOnFocus="CaretToBeginning"/>

Please note, that the leading zeros will still be removed when the control loses focus. I believe, that in this scenario, it would be more appropriate to work with the text input control.

<telerik:RadMaskedTextInput Mask="#21" Value="{x:Null}" 
                      SelectionOnFocus="CaretToBeginning"/>
Could you please give us more details on your last request? For the numeric input, you can use it with the same setup just by changing the token type : Mask="p9.2"

Greetings,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Marco Teodoro
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Share this question
or