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

[Solved] Different numeric formatting on each row

1 Answer 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Randy
Top achievements
Rank 1
Randy asked on 31 Oct 2011, 04:34 AM
I have a grid that contains a fixed number of rows.  Each row has 13 columns - a description and a column for each month in a year.  Some of those rows contains integers, some decimals, and some percentages.  I would like to format the integers as whole numbers, the decimals as currency with the $ sign, and the percentages as decimals with 2 places but no currency symbol.  The user can enter data into each of these cells.  The entity that this data comes from has a field that is not bound to the grid that can be used to identify each row with the type of formatting it should be (i.e. 1 for int, 2 for currency, 3 for decimal).

What I need is to correctly format these cells so that the behave as close to having them in their own grids with static formatting.  I have tried Data Templates and Converters, but the only solution that seems to work is to have separate grids.  Any help would be appreciated.

-Randy

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 31 Oct 2011, 09:12 AM
Hello Randy,

You can benefit from DataTemplateSelector and depending on the value of the property used for formatting it (1 for int, 2 for currency, etc.). If you want the same behavior in edit mode as well, you can use CellEditTemplaetSelector as well. Please take a look at our online documentation and demos for a reference.
Let me know in case you need any further assistance.
 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Randy
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or