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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing trailing zeros in DataBoundGrid

Thread ID:





10136 Jan 22,2004 08:23 PM UTC Jan 22,2004 09:29 PM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On January 22, 2004 08:23 PM UTC

Hi, I am using DataBoundGrid I have a decimal column. How do I remove trailing Zeros from the decimal number when I show it in all my grids? FYI, run CurrencyCells sample and set one of the CellType to "TextBox" and CellValueType to decimal. If you enter "53.89400", it converts the value to "53.894". How can I get the same behavior in a databound grid? thanks, - Reddy

Administrator [Syncfusion]
Replied On January 22, 2004 09:26 PM UTC

Try setting: GridStyleInfo style = this.gridDataBoundGrid1.Binder.InternalColumns[2].StyleInfo; style.CellValueType = typeof(double); style.Format = "0.000";

Administrator [Syncfusion]
Replied On January 22, 2004 09:29 PM UTC

If you do not want to always have 3 decimal places, you can use the # formatting character instead of the 0. style.Format = "0.###"; 1.200000 is shown as 1.2 1.1234567 is shown as 1.123


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon