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

GridViewDecimalColumn.DecimalPlaces

4 Answers 667 Views
GridView
This is a migrated thread and some comments may be shown as answers.
MikeB
Top achievements
Rank 1
MikeB asked on 27 Jan 2009, 06:06 PM
I have a RadGridView with a GridViewDecimalColumn.  A row has the value of 51.34.  I set the DecimalPlaces property to 0 but the value still displays as 51.34.  Should this not display as 51?

4 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 28 Jan 2009, 02:59 PM
Hi MikeB,

The DecimalPlaces property has effect only on the spin editor when editing the cell. You can control the cell appearance through the FormatString property. The following code removes the fraction part from the cell value:

this.radGridView1.Columns["Value"].FormatString = "{0:0.}"

I hope this helps. Do not hesitate to write me back if you have any questions.

Kind regards,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jippy
Top achievements
Rank 1
answered on 25 Oct 2012, 06:08 AM
Hi,
   I have decimal values in telerik grid view data column, i formatted it and showing properly but when i try to edit the value and double click on it, it displays a bunch of zeros after the decimal point.Now i want to remove all those zeros when i double click for editing.Can anybody please help me out on this as soon as possible?
0
Stefan
Telerik team
answered on 30 Oct 2012, 06:34 AM
Hi Jippy,

Thank you for writing.

If you set the DecimalPlaces property of the column to zero, all decimals should be removed:
GridViewDecimalColumn col = new GridViewDecimalColumn();
           col.DecimalPlaces = 0;

I hope this helps.
 
Kind regards,
Stefan
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
0
Jippy
Top achievements
Rank 1
answered on 22 Nov 2012, 06:06 AM
Hi Stefn, Thanks for the reply.
Tags
GridView
Asked by
MikeB
Top achievements
Rank 1
Answers by
Jack
Telerik team
Jippy
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or