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

How to avoid displaying number in scientific fromat

7 Answers 106 Views
Input
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 28 Aug 2008, 02:48 PM
I used RadNumericTextBox for credit card number as follows:

<

telerik:RadNumericTextBox ID="CCNum" runat="server" MaxLength="16" EmptyMessage="Enter Card Number" NumberFormat-AllowRounding="False" NumberFormat-DecimalDigits="0" MinValue="0" MaxValue="9999999999999999" NumberFormat-GroupSeparator=" " NumberFormat-GroupSizes="4"></telerik:RadNumericTextBox>

The only issue I have is that after postback the number is displayed in a scientific format, e.g. 1.234567890123456E+15. When I set focus to the field and unfocus it the number is back to the proper format: 1234 5678 9012 3456.

How to fix it?

7 Answers, 1 is accepted

Sort by
0
Missing User
answered on 28 Aug 2008, 02:55 PM
Hello miksh,


The RadNumericTextBox control does not support maximum and minimum values with a greater magnitude than +/- 2^46. Setting the MaxValue property to more than 2^46 or the MinValue property to less than -2^46 can cause abnormalities in the RadNumericTextBox behavior.

Using RadNumericTextBox

All the best,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
miksh
Top achievements
Rank 1
Iron
answered on 28 Aug 2008, 03:07 PM
Fine. What is the bottom line? Can I use the RadNumericTextBox in this scenario? If no, what other options could you suggest? The requirements are:
- prevent enetring non-digit symbols
- don't confuse users with "mask" behaviours
0
Missing User
answered on 28 Aug 2008, 03:28 PM
Hello miksh,


You can use RadTextBox and ASP.NET validation controls that are provided with ASP.NET. These controls enable you to check the user's input based on a pattern defined by a regular expression. Take a look at Validating ASP.NET Server Controls for a complete explanation of validation controls and how to use them in your ASP.NET pages.

Let us know whether this helps


Kind regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
miksh
Top achievements
Rank 1
Iron
answered on 28 Aug 2008, 03:40 PM
Could RadTextBox filter non-digit symbols out when a user typing the number?
0
Missing User
answered on 28 Aug 2008, 03:52 PM
Hi miksh,

The following code example demonstrates how to achieve your goal:

        <div> 
            <script type="text/javascript"
            function KeyPress(sender, args) 
            { 
                var regexp = new RegExp("[0-9]{1}"); 
                if (!args.get_keyCharacter().match(regexp)) 
                    args.set_cancel(true); 
            } 
            </script> 
            <telerik:RadTextBox ID="RadTextBox1" runat="server"
                <ClientEvents OnKeyPress="KeyPress" /> 
            </telerik:RadTextBox> 
        </div> 



Greetings,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
miksh
Top achievements
Rank 1
Iron
answered on 28 Aug 2008, 03:58 PM
Thanks for the code.
The only my concern is we've chosen the telerik controls to avoid spending time for such coding. I would appreciate very much if you could increase min/max range for numerictextbox in the next releases. 
0
Missing User
answered on 28 Aug 2008, 04:06 PM
Hi miksh,

Thank you for the suggestion. Actually 2^46 is the maximum value that the parseInt and parseFloat javascript global functions can handle.  Nevertheless, I have passed your comments to our developers, for further consideration.

Best wishes,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Missing User
miksh
Top achievements
Rank 1
Iron
Share this question
or