Note that there are some explanatory texts on larger screens.

plurals
  1. POData Annotations + MVC3 + Culture Issue
    primarykey
    data
    text
    <p>I'm having a problem working with Cultures, MVC3 and Data Annotations. I defined a table <code>STORES</code> on a spanish database <code>(COLLATION is set for LATIN_GENERAL);</code> some of the fields are defined in SQL as <code>DECIMAL(18,2) NOT NULL</code>. On my MVC3 Application I already set culture for "es-ES" on the web.config file. Also, I am using all my views strongly-typed.</p> <p>If I use DataAnnotations for validations, it would automatically add the <code>Required field</code> and <code>The field must be a number</code> validations. That would be perfect except for one thing:</p> <p><code>The field must be a number</code> validation is forcing me to use dot(.) as decimal separator instead of comma(,). So, I don't know how to change it nor how to translate this error message. Then I thought I might force the user to use dot instead of comma with jquery (ugly-solution). So, I did it just to make some tests and the result was that it allowed me to pass the validations and created perfectly the object in database. </p> <p>But here comes the weird, when I'm editting that same object, it's shown on my same strongly typed form with comma as a decimal separator instead of dot. So what's the problem? That the user can't never submit an edition of the object.</p> <p>What am I doing wrong?</p> <blockquote> <ol> <li>Added the proper collation to the database.</li> <li>Added the globalization attribute on the web.config file.</li> <li>I even tried this <a href="https://stackoverflow.com/questions/5199835/mvc-3-jquery-validation-globalizing-of-number-decimal-field">MVC 3 jQuery Validation/globalizing of number/decimal field</a> with no success...</li> </ol> </blockquote> <p>Which is the proper way to do this? </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload