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

Formatting Numeric Columns in a GridDataBoundGrid

Thread ID:





8973 Dec 1,2003 04:01 PM UTC Dec 1,2003 04:49 PM UTC WinForms 2
Tags: GridControl
Dan Johnson
Asked On December 1, 2003 04:01 PM UTC

I have a simple question but I haven''t been able to find the answer or a sample in the documentation. I would like to format an entire floating point column of data coming from a DataSet in a GridDataBoundGrid. For instance, I would like to round the numbers for an entire column to 2 decimals and put commas in for every third digit left of the decimal point ( ie 5,232,233.54 ). Can someone point me in the right direction or show an example of how to do this? Thanks, Dan

Jim Frapper
Replied On December 1, 2003 04:34 PM UTC

Hey Dan, You can just change the cell type for the columns in your databound grid. For example... this.grdAppointments.Binder.InternalColumns[1].StyleInfo.CellType = "Static"; Search in the ".NET style documentation" for CellType. This will give you the list you are looking for. For your specific cell type, you could use NumericUpDown, Currency, MaskedEdit, or even Static(if you format you value before you set it). Cheers, JF

Administrator [Syncfusion]
Replied On December 1, 2003 04:49 PM UTC

In addition to setting the CellType property, this.grdAppointments.Binder.InternalColumns[1].StyleInfo.CellType as Jim mentioned, you can also set the Format property and the CellValueTyle property. this.grdAppointments.Binder.InternalColumns[1].StyleInfo.Format = "#.####"; //or "F4" or ??? this.grdAppointments.Binder.InternalColumns[1].StyleInfo.CellValueType = typeof(double)


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