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

Different Decimal Formats in Same Column

1 Answer 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 16 Jul 2020, 03:23 PM
A gridview (read only) has a quantity column that is normally formatted with zero decimal positions.  Now we have a situation where the values in some rows will have significant decimal values and others will not.  Can I set the decimal format of individual cells (hoping that CellFormatting event is part of that solution)?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Jul 2020, 02:20 PM

Hello, Gary,

GridViewDecimalColumn offers the DecimalPlaces property which specifies how many decimal places to be shown in the numeric values. However, this doesn't seem to be suitable for your scenario.

The appropriate way to achieve different format of the cells belonging to the same column is to use the CellFormatting event and specify the CellElement.Text considering cell's Value, RowInfo and ColumnInfo. Setting the CellElement.Text actually indicates what text to be shown in the cells.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Tags
GridView
Asked by
Jay
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or