forum

Home / DeveloperSection / Forums / What is DataAnnotations in mvc?

What is DataAnnotations in mvc?

Anonymous User194609-Oct-2014
Here is a class "Cars" and I have 2 attributs (min/max CO2).
publicclassCars
        {
            [Range("MinCO2", int.MaxValue, ErrorMessage = "MaxCO2 < MinCO2")]
            publicint MaxCO2 { get; set; }
            [Range(0, "MaxCO2", ErrorMessage = "MaxCO2 > MinCO2")]
            publicint MinCO2 { get; set; }
        }

I use the Data Annotation 'Range' to fix the minimum and the maximum value.

But I want to use the car's attribut to fix the minimum or the maximum value.

Or if there is another solution with jQuery, it can be possible.


Updated on 09-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By