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

[Solved] GridNumericColumn in Edit Mode doesn´t use current culture

1 Answer 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Foenix
Top achievements
Rank 1
Foenix asked on 29 Jul 2009, 09:21 PM
Hi!
I use GridNumericColumn to display some floating-point value. In the ViewMode the value is displayed correctly, according to the current  culture's settings (with comma as an digital separator). In the EditMode (EditMode="InPlace") the value is displayed correctly too, but it doesn't use DataFormatString parameter (e.g if the value is 5.0 and DataFormatString="{0:F2}", the value is displayed as 5). It's not really good, but the real problem comes when I'm trying to input some value with fractional part (like 5.323). In my current  culture's settings decimal separator is comma, so EditBox doesn't allow me input period, only comma. But when I'm trying to save my input, I receive message like "5,323 is not a valid value for Double". DataSource for RadGrid is ObjectDataSource and it return the list (List<>) of classes. In the code it looks like that:
<telerik:GridNumericColumn HeaderText="SomeText" DataField="DoubleField" DataType="System.Double"
         SortExpression="DoubleField" UniqueName="DoubleField"
         DataFormatString="{0:F2}" MaxLength="12" NumericType="Number">
     <ItemStyle HorizontalAlign="Right" /> 
     <HeaderStyle HorizontalAlign="Right" Width="60px"/> 
</telerik:GridNumericColumn> 

Single object is defined like that:
public class MyClass 
    // properties 
... 
      private double    mDoubleField; 
      public double DoubleField 
      { 
         get { return mDoubleField; } 
         set { mDoubleField = value; } 
      } 
... 

Could you tell me why does it happen and what should I do to solve this problem?

I use Q2 2009 Telerik RadControls for ASP.NET


1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 04 Aug 2009, 10:41 AM
Hi Volodymyr,

When you have properly set your current page culture, RadGrid should not have problems converting your string representation to a valid double variable. Check the sample page I have created for your reference. The same scenario is demonstrated, only RadGrid's UpdateCommand event is used to update the data store.

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Foenix
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or