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

GridNumericColumn Decimal Values changing to Scientific Notation

8 Answers 607 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 01 Feb 2012, 10:53 PM
I'm using a RadGrid with a GridNumericColumn as: 

<telerik:GridNumericColumn DataField="VALUE" HeaderText="Testing Decimal Value" DecimalDigits="6" DataType="System.Decimal" UniqueName="VALUE" NumericType="Number" />

When I enter a decimal value as 1.000015 it is accepted and I'm able to successfully process this value when accessing the hash table in my custom update command. However, when I try to enter a value with as 0.000015 or -0.000015 it turns into scientific notation (0.5E-05) when attempting to update the value and errors out. I have tried setting the AllowRounding to true or false as well as setting the KeepNotRoundedValue to true or false without any change. This problem only occurs if I use a value starting with a 0 and using more than 3 zeros in the precision, i.e. 0.00001. 

I see in the Q1 2012 BETA there is a fix that may resolve my issue? (Fixed: RadNumericTextBox applies scientific notation on focus and wrong value on blur when DecimalDigits and AllowRounding are set and value like 0.0000001 is entered)

I'm unable to update to the BETA at this time and need to know if there is a possible workaround for this precision problem? Any help would be appreciated.

Thanks,
Brandon 

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Feb 2012, 06:22 AM
Hello Brandon,

I cannot replicate the issue at my end. Try setting the DataFormatString property which worked as expected.
aspx:
<telerik:GridNumericColumn DataField="Discount" HeaderText="Discount ID" KeepNotRoundedValue="true" DataFormatString="{0:f5}"  AllowRounding="false" UniqueName="Num" />

-Shinu.
0
Brandon
Top achievements
Rank 1
answered on 02 Feb 2012, 03:13 PM
Hi Shinu,

I tried your properties like so without any luck? I also tried setting the DataType to System.Double but not change when using a value of 0 with 6 decimal digits and the first four digits are zero's, i.e. 0.000013 or -0.000013. Works if I only use 3 zeros, 0.000123 or -0.000123. The value turns to 0.3E-05 after update/insert is fired and displays that scientific notation in the grid but once I click in that textbox the value turns back to 0.000013.

<telerik:GridNumericColumn DataField="CAPITAL_ADJ_BASE_RATE_DIST" HeaderText="Capital Adjustment Base Rate Distribution" DataType="System.Decimal" UniqueName="CAPITAL_ADJ_BASE_RATE_DIST" NumericType="Number" KeepNotRoundedValue="true" DataFormatString="{0:f5}" AllowRounding="false" />
0
Mira
Telerik team
answered on 06 Feb 2012, 12:14 PM
Hello Brandon,

The described issue is a bug which is already resolved.
You can find the fix in the latest internal build or in the Q1 2012 Beta release.

I hope this helps.

Greetings,
Mira
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Brandon
Top achievements
Rank 1
answered on 06 Feb 2012, 01:41 PM
Hi Mira, I'm instructed not to use BETA versions for my work and need to find a workaround for this problem until the next quarter release is out. Is there any workaround besides doing away with the numeric column editor altogether?
0
Accepted
Mira
Telerik team
answered on 09 Feb 2012, 12:24 PM
Hello Brandon,

You can download the latest internal build which contains the desired fix.

Regards,
Mira
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Judy
Top achievements
Rank 1
answered on 26 Jun 2012, 03:30 PM
We've been experiencing a similar problem.  When editing a value of 0.000001 in a grid column it changes the display to scientific notation like 1E+06.  I installed the Q2 2012 update and the problem is still occuring.  Any ideas what we can do to fix this ?
0
Milena
Telerik team
answered on 29 Jun 2012, 10:57 AM
Hello,

I tried to replicate the unwanted behavior with Q2 2012 version of RadControls, but no avail. Could you please isolate the problem in a small working project and I will debug it locally and come back to you with the findings?

Regards,
Milena
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Robert
Top achievements
Rank 1
answered on 10 Jul 2012, 05:26 PM
Support ticket 563762 submitted for this issue.  Attached a .zip file of the code and screen shots of the what the grid is doing in displaying .000001 in scientific notation.
Tags
Grid
Asked by
Brandon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brandon
Top achievements
Rank 1
Mira
Telerik team
Judy
Top achievements
Rank 1
Milena
Telerik team
Robert
Top achievements
Rank 1
Share this question
or