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

Decimal Column

1 Answer 265 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nadia Sangiovanni
Top achievements
Rank 1
Nadia Sangiovanni asked on 29 Mar 2010, 04:55 PM
Hi Experts,

I add decimal columns into my grid. My application is base on the example GridView/Columns/Column type example.

My problem is when I try to set the appropriate DecimalPlaces no change appear to the grid view. For example, it show 500.000 instead of 500.

I try to do a modification to the code of the Telerik Grid example and change the numeric column decimal places from 0 to 2 and I got the same result then in my application; decimal place didn't change and the numeric column still show 0 decimal places...

What I am doing incorrectly?

Thanks
Nadia

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 01 Apr 2010, 12:22 PM
Hello Nadia Sangiovanni,

In order to show a formatted value for you column, you must handle the CellFormatting event of RadGridView:

if (e.CellElement.ColumnIndex == 0)
{
    e.CellElement.Text = String.Format("{0:N3}", ((GridDataCellElement)e.CellElement).Value);
}

The DecimalPlaces property of Decimal column is used to format the value only in edit mode when the GridSpinEditor is active.

Sincerely yours,

Julian Benkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Nadia Sangiovanni
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or