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

The field Duration must be a number.

2 Answers 67 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.
arnorgauti
Top achievements
Rank 1
arnorgauti asked on 13 Mar 2012, 02:43 PM
Hi

I´m using Telerik grid with edit pop-up option. (razor view engine)

I'm using
http://demos.telerik.com/aspnet-mvc/razor/Grid/EditingServerSide?theme=default
for an example

When i bind the data to grid the member property is a decimal variable and appears as "5,75" which is correct because my current culture is icelandic or is-IS

When i push Edit Button it opens up a pop-up windows with a form and variable shows up as "5,75" but when i push the Update button or tab change from this input i gives me and validation error:

"The field Duration must be a number."

the input stops being red when i change the input from "5,75" to "5.75"

1. How can i fix that validation know that a comma separator is "the correct way" ?
2. It that's not possible... how can i just turn this client validation off ?

2 Answers, 1 is accepted

Sort by
0
Dadv
Top achievements
Rank 1
answered on 14 Mar 2012, 10:02 AM
Hi,
First, did your globalization is on?

@(Html.Telerik().ScriptRegistrar().Globalization(true))

if it is, so try to turn off the validation like this :

@(Html.Telerik().ScriptRegistrar().jQueryValidation(false).Globalization(true)) 
0
Dadv
Top achievements
Rank 1
answered on 14 Mar 2012, 10:19 AM
Otherwise, you could change the editor template in the share views (number.cshtml) and define a similar metric system directly to the control (de-DE?)

Html.Telerik().NumericTextBoxFor(m => m).DecimalSeparator(",")
        .InputHtmlAttributes(new { style = "width:100%" })


edit: changed some values
Tags
Grid
Asked by
arnorgauti
Top achievements
Rank 1
Answers by
Dadv
Top achievements
Rank 1
Share this question
or