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

[Solved] Using decimal number in edit grid

1 Answer 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christian
Top achievements
Rank 1
Christian asked on 19 Apr 2011, 03:28 PM

Hi

 

Im trying to edit a decimal number in the mvc editor grid.

In my model it is defined as:

public decimal Percent { get; set; }

 

It should have the format 0,00

I have set the .Format("{0:F2}") on the column which works fine, but when I try to edit the field it automatically removes the “,00” in the text field. When I try to type “,” in the text field it gives an error and says in must be a number.

 

How can I get the edit textfield to display the 0,00 format and allow “,”?

 

1 Answer, 1 is accepted

Sort by
0
Kairat
Top achievements
Rank 1
answered on 07 May 2011, 08:32 PM
HalloChristian!

I have similar issue.

Did you found any solution?

Best regards,
Kairat


Fixed by using string property in the model instead decimal.

columns.Bound(o => o.Rate1Str ).Title("Rat1").Width(50).ReadOnly(true);
       columns.Bound(o => o.Rate2Str).Title("Rate2").Width(50).ReadOnly(true);
       columns.Bound(o => o.Rate3Str).Title("Exam").Width(50).Format("{0:d}");
       columns.Bound(o => o.Rate4Str).Title("Summary").Width(50).ReadOnly(true);
       


Tags
Grid
Asked by
Christian
Top achievements
Rank 1
Answers by
Kairat
Top achievements
Rank 1
Share this question
or