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

Use "k" as shorthand for thousands

3 Answers 44 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Scott Waye asked on 18 Nov 2016, 03:22 PM

Hi,

I'm using the RadMaskedCurrencyInput in a no mask scenario (Mask="") and I want to allow the users to type "1k" and get the value pushed back to the underlying viewmodel as 1000.  I've looked at the source code and the available overrides, and I can't see a suitable place to achieve this.  Any ideas?

 

3 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 23 Nov 2016, 12:51 PM
Hi Scott ,

The RadMaskedCurrencyInput is made to accept digits and this is why I would suggest you to use RadMaskedTextInput control. In order to push back the value you have entered multiplied by 1000 when "k" is typed, simply use a converter for the MaskedTextInput's Value property. Depending on the input if it ends with "k" return the value you would expect.

Hope this helps.

Regards,
Peshito
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Scott Waye
Top achievements
Rank 2
Veteran
Iron
answered on 07 Apr 2017, 07:05 PM

Looks like a possible workaround is

 

protected override void ProcessChar(char inputSymbol)
{
    if (inputSymbol == 'k' || inputSymbol == 'K')
    {
        base.ProcessChar('0');
        base.ProcessChar('0');
        base.ProcessChar('0');
    }
    else if (inputSymbol == 'm' || inputSymbol == 'M')
    {
        base.ProcessChar('0');
        base.ProcessChar('0');
        base.ProcessChar('0');
        base.ProcessChar('0');
        base.ProcessChar('0');
        base.ProcessChar('0');
    }
    else base.ProcessChar(inputSymbol);
}
0
Accepted
Peshito
Telerik team
answered on 11 Apr 2017, 06:38 AM
Hello Scott,

I am glad you have found another workaround that is suitable for you. It does seem to be doing the result you would expected for your scenario. Thank you for sharing it with us!

Regards,
Peshito
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Answers by
Peshito
Telerik team
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Share this question
or