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

Format Edited Value

6 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 14 Feb 2013, 03:26 PM
Hi,

When I edit cell values the new values don't get formatted.

For example, if I edit a value on a column which has a data format string of N2 and I enter the number 1.2345678 I would expect the number to be formatted to 1.23 but the full number is displayed.

I was wondering if there was a way to get the edited values to adopt the formatting specified on the column?

Thanks,

Steven

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Feb 2013, 03:34 PM
Hello,

 Generally formats are used only for display purposes. Still if you want to use this when edit values you can place TextBox in desired column CellTemplate and specify desired format for the Text property binding. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Steven
Top achievements
Rank 1
answered on 14 Feb 2013, 03:40 PM
Hi Vlad,

Displaying the full value whilst editing it is fine, but after I finish editing the value I would like it to be displayed formatted as the rest of the values in the column.

Thanks,

Steven
0
Vlad
Telerik team
answered on 15 Feb 2013, 09:38 AM
Hello Steven,

 Are you using DataFormatString property of the column or StringFormat property of the DataMemberBinding? 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Steven
Top achievements
Rank 1
answered on 15 Feb 2013, 09:56 AM
Sorry I think I misinterpreted your original reply. I am using the DataFormatString on the column. If i add a template to the CellTemplate with the format specified on the binding as you suggested in your first reply will that work?

Thanks,

Steven
0
Vlad
Telerik team
answered on 19 Feb 2013, 09:45 AM
Hello Steven,

 Can you send us small example project demonstrating your scenario via support ticket? We will review once going on in your case and we will let you know about our findings.

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Steven
Top achievements
Rank 1
answered on 21 Feb 2013, 11:47 AM
Hi,

I figured out my problem. We are building the grids dynamically and the grids contain various types of data so each of the cells are bound to a value of type object. When we create the grid the numbers are of type double so they are formatted. After we edit the values they become type string so the formatting is not applied.

Thanks for your help,

Steven
Tags
GridView
Asked by
Steven
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Steven
Top achievements
Rank 1
Share this question
or