We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GDBG - NumberFormat - Exponent

Hi! In our grid (GridDataBoundGrid) we have some floats and doubles displayed. When they reached a certain size they are displayed with an exponent E. I tried to set the CulterInfo on the TableStyle property and defined the NumberFormat. But that seems not to work. The numbers are still displayed with an exponent. How can I get rid of that E? code: this.grid.TableStyle.CultureInfo = new CultureInfo( "de-CH", true ); this.grid.TableStyle.CultureInfo.NumberFormat.NumberDecimalDigits = 8; this.grid.TableStyle.CultureInfo.NumberFormat.NumberGroupSeparator = "''"; this.grid.TableStyle.CultureInfo.NumberFormat.NumberGroupSizes = new int[] { 3 }; Cheers! Dan

1 Reply

AD Administrator Syncfusion Team July 1, 2004 06:13 AM UTC

You can set grid.TableStyle.Format to control how numeric CellValueTypes are displayed. Some sample format strings you could try are "F", "F4", "#.###", "0.000", "#.0000", or "#.#####################". Now the number of significant digits displayed will conform to the the Type, roughly 7 digits for floats and 14-15 digits for doubles. So, if your user types 10 significant digits into a float cell, then he will lose some of the significance when the string value inputted is converted to a float value for storing, and the display will be affected. If you do not want this, then I think you would have to change the CellValueType to string, and the formatting would not be applied (as style.Format only affects non-string CellValueTypes).

Loader.
Live Chat Icon For mobile
Up arrow icon