3

Possible Duplicate:
How to change 'data-val-number' message validation in MVC while it generate by helper

Main question is: Where 'data-val-number' message comes from? From what validation rule?

We are localizing our ASP.Net MVC 3 application. For localizing validation messages we decided to use DataAnotationExtension package. So, for each attribute to be localized there is a simple Localized+AttributeName+AttributeAdapter.cs which takes validation rule from attribute and changes validation message. The only problem we have is Numbers. Validation message for numbers comes to client like that:

data-val-number="The field CurrencyAmmount must be a number."

and we don`t know where it comes from.

Community
  • 1
  • 1
y.selivonchyk
  • 8,987
  • 8
  • 54
  • 77
  • there is another solution for this problem, described in this topic: http://stackoverflow.com/questions/4828297/how-to-change-data-val-number-message-validation-in-mvc-while-it-generate-by-h But we have already chosen another way. – y.selivonchyk Nov 09 '11 at 09:19
  • which other way did you choose? – Nelson Reis Feb 22 '12 at 15:12
  • 1
    @NelsonReis There were only several places where we needed this attribute so we choosen the simplest way: directly add this attribute to page element.`@Html.TextBoxFor(model => model.SomeFloat, new { data_val_number = "Custom validation massege" })` – y.selivonchyk Feb 23 '12 at 09:10
  • I've used [Griffin MVC Contrib](http://www.codeproject.com/Articles/352583/Localization-in-ASP-NET-MVC-with-Griffin-MvcContri) project to localize the validation texts without ugly attributes – Eduardo Molteni Jul 16 '12 at 14:19

0 Answers0