I've installed Scott's Kirkland DataAnnotationsExtensions.
In my model I have:
[Numeric]
public double expectedcost { get; set; }
And in my View:
@Html.EditorFor(model => model.expectedcost)
Now, when the page tries to render I get the following error:
Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: number
Any ideas why I'm getting the error ?
The quick answer is simply remove the attribute
[Numeric]
The longer explanation is that by design, validation already adds a data-val-number because it's of type double. By adding a Numeric you are duplicating the validation.
this works:
[Numeric]
public string expectedcost { get; set; }
because the variable is of type string and you are adding the Numeric attribute.
Hope this helps