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

[Solved] decimal points in edit mode

3 Answers 159 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.
Hai
Top achievements
Rank 1
Hai asked on 16 Jun 2011, 04:18 PM
How to control the decimal points showing in a cell when it is in edit mode? I have the following xaml:

 <telerik:GridViewDataColumn UniqueName="InvoiceAmount" DataMemberBinding="{Binding InvoiceAmount}" DataFormatString="#,##0.00;(#,##0.00)">

The number is displayed correctly with two decimal points when GridView is showing. But when I click on the cell and get into edit mode, it shows 4 decimal points. What's the easiest way to only show 2?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Jun 2011, 05:15 PM
Hi,

 Generally DataFormatString will be applied for view-mode only - you can use CellEditTemplate to define desired UI with desired settings for edit-mode.  

All the best,
Vlad
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
0
Hai
Top achievements
Rank 1
answered on 16 Jun 2011, 05:58 PM
I am trying to avoid creating my own edit template because:
1. I have a lot of columns.
2. I lose the data type validation automatically supplied by GridView. Building them with my TextBox will take some time.

So, how do I ensure the data I feed to the GridView will only display with 2 decimal points in edit mode? i tried to round off the data to no avail. In your implementation how do you control the decimal points based on the data? If I can just manipulate the data without creating my custom edit template that will save me a lot of work.

Thanks.
0
Hai
Top achievements
Rank 1
answered on 16 Jun 2011, 06:08 PM
The data I am binding to has a type of decimal. But even when I set the value (not the type) to an integer, it shows 4 decimal points in edit mode.
Tags
GridView
Asked by
Hai
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Hai
Top achievements
Rank 1
Share this question
or