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

RadNumericTextbox notation and rounding problems

3 Answers 194 Views
Input
This is a migrated thread and some comments may be shown as answers.
Gilbert
Top achievements
Rank 1
Gilbert asked on 07 May 2010, 05:32 PM
Hi,

I'm using RadNumericTextbox up to 15 decimal places right now and having some formatting and rounding problems. When I enter a value like 0.0000000008 into the textbox when it loses focuses it turns into 8. When I put it back into focus it turns into 8e-10. At this point if I defocus the textbox the value turns into a permanent 8. Is there any way where I can make it show 0.0000000008 for all cases? I'm trying not to show the exponential notation and not have it show it as a whole number when it is actually a very small number.

Also since numerictextbox uses double and goes up to 15 total digits I'm trying to truncate the excess digits rather than rounding it. e.g. 1.12345678901234567890 turns into 1.1234567890123457 on defocus and on postback it turns into 1.12345678901235. Is there any way to not get rounding for both these cases? This is what I have for my example:

<telerik:RadNumericTextBox runat="server" ID="rntbTest" Width="100">  
            <NumberFormat DecimalDigits="15" KeepNotRoundedValue="false" AllowRounding="false" />  
</telerik:RadNumericTextBox> 

Thanks!
Gilbert

3 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 07 May 2010, 08:22 PM
This post should be of use to you.


Apparently, I don't believe what you want to do is possible with the RadNumericTextbox.
0
Gilbert
Top achievements
Rank 1
answered on 07 May 2010, 10:02 PM
Hi Robert,

I have read that thread before posting this thread but I wanted to use NumericTextBox functions like spin button and have the values come back directly as double instead of string. I guess it's really the only option I can use now?

Can RadInputManager manipulate the ASP textbox type to double? I can forgo the spin button but having it come back as double helps lessen the changes I have to make to change all the NumericTextBoxes to textboxes.

Furthermore, when I get an validation error from RegExpTextBoxSetting (^[0-9]*$) the box turns red and blocks post back. Is there a way to still allow post back and have the textbox return an empty string without turning validation off for my buttons? In NumericTextbox when you enter a letter the box just flashes and blocks the character from input which is helpful.

Thanks!
Gilbert
0
Veli
Telerik team
answered on 12 May 2010, 12:00 PM
Hi Gilbert,

As far as my observations go, RadNumericTextBox successfully manages to format the value 1.12345678901234567890. When it is blurred, the value is formatted to 1.123456789012345 with AllowRounding="False" and 15 dicimal digits. Testing with the latest version of RadControls 2010.Q1.415 (which you have indicated to be using).

Greetings,
Veli
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
Input
Asked by
Gilbert
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Gilbert
Top achievements
Rank 1
Veli
Telerik team
Share this question
or