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

Removing trailing zeros in DataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

10136 Jan 22,2004 03:23 PM Jan 22,2004 04:29 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 22, 2004 03:23 PM

Hi, I am using DataBoundGrid 1.6.1.8. 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 04:26 PM

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 04:29 PM

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

CONFIRMATION

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.

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.

;