How do I have to configure the RadMaskedNumericInput Control so that:
1. the user can enter any decimal number with any precision, with or without a decimal separator, positive or negative
2. no mask placeholders or literals are visible (no _ and a the decimal separator only visible when the user actually entered one)
3 Answers, 1 is accepted
Hello Jim,
Thank you for your interest in our RadMaskedInput controls.
Upon reading your requirements, there is not a build-in set-up to achieve this. The struggle comes from the fact that the user can enter a different number of digits after the dot. So you will need to remove the Mask property and work with No Mask scenario. This way, you can't enter decimal dot separator as the control is not aware of how many numbers after the dot will be entered.
<telerik:RadMaskedNumericInput Placeholder=" " Mask="" Height="30" Width="200" />
What you can consider is using our RadMaskedTextInput control. The struggle here will be that you will need to handle the input which comes from the user. For example, you can subscribe to the PreviewKeyDown event of the control and check if the user enters numbers. If not, handle the event. For example:
<telerik:RadMaskedTextInput Mask="" Height="30" Width="200" VerticalAlignment="Center"
PreviewKeyDown="RadMaskedTextInput_PreviewKeyDown" Placeholder=" "/>
private void RadMaskedTextInput_PreviewKeyDown(object sender, KeyEventArgs e)
{
if( ! (e.Key == Key.D0 ||
e.Key == Key.D1 ||
e.Key == Key.D2 ||
e.Key == Key.D3 ||
e.Key == Key.D4 ||
e.Key == Key.D5 ||
e.Key == Key.D6 ||
e.Key == Key.D7 ||
e.Key == Key.D8 ||
e.Key == Key.D9 ||
e.Key == Key.OemPeriod
))
{
e.Handled = true;
}
}
The above code snippet will cover only one scenario. You will need to extend it so it covers all keyboard numbers (NumPad numbers). Also, handle the case when the user press dot again, etc.
Can you give the above suggestion a try and let me know if I have missed something from your scenario?
Regards,
Dinko
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
![](/forums/images/avatarimages/065c3a2f-37c7-4d66-a5de-78b9834f771fsimhorizonlogo_abbreviated_simple_square_250.png)
I have this exact same requirement, it's a shame your controls can't handle this usage case. Could this feature request please be added to any future update/release? Most other 3rd party control vendors do allow for this usage case.
Cheers, Rob.
Hi Robin,
The RadMaskedNumericInput does not support entering values in scientific (exponent) format. A Feature Request regarding this is already logged in our Feedback Portal. I apologize for missing this in my first post. You can vote for its implementation to increase its priority.
If you want to have a dynamic format you can take a look at the Dynamic format string SDK example where you can see how you can change the FormatString property runtime. This way the user can enter a valid double value without restriction in the number of digits on both sides of the decimal point. Also, you can download our SDK Sample Browser where you can find the mentioned project.
Regards,
Dinko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.