Data Format on a cell level in batch grid

1 Answer 89 Views
Grid
David
Top achievements
Rank 1
Iron
Iron
Veteran
David asked on 27 Oct 2023, 09:55 AM

I would like to put DataFormat on a cell level in a batch grid.

Jobs #                  5 

Unemployment  3.25% 

What is the best way?

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 27 Oct 2023, 03:44 PM

Hi David,

To format how data appears in the cell, you will need to use the DataFormatString property and apply a format from the Standard Numeric Format specifier.

The following example will display the Numeric values as percentages with 2 decimal digits.

<telerik:GridNumericColumn  DecimalDigits="2" DataFormatString="{0:P2}"  />

The DecimalDigits property controls how many decimal digits the underlying NumericTextBox will allow you to introduce.

I hope this be helpful.

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
David
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 27 Oct 2023, 07:21 PM

I am familiar with this approach.

Maybe, i didn't explain my problem in best manner. i need different, conditional format for some rows. 

I tried on ItemDataBound, but could not make it perfect.

Ideas?

 

Attila Antal
Telerik team
commented on 30 Oct 2023, 12:32 PM

ItemDataBodund event is the one that is triggered for each row and when the data is available. If you want to apply conditional formatting for the rows based on their data, ItemDataBound is the way to go.

To format a value, access the Cell, then the cell's value, format is as needed and set the Cell's Text property with the formatted value.

The following documentation shows using the APIs to do that, see Accessing Cells

David
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 30 Oct 2023, 12:47 PM

I did that. My problem is that this way i can't control allowed decimal points at the time of entry. 

Oh well

Thank you

Tags
Grid
Asked by
David
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Attila Antal
Telerik team
Share this question
or