On one of the view model fields, I have set the min length in ASP.NET MVC Data Annotation attribute.
[MinLength(5, ErrorMessage = "A minimum of 5 digits is required")]
Based on a dropdown selection(which has 2 values), MinLength needs to be updated to 10. ClientSideValidation is enable and so validation needs to reflect the changes before it is posted back to the controller.
Tried changing the attribute "data-val-minlength-min" using jQuery based on dropdown value, but it did not change the validation.
Any suggestions please.
MinLengthattribute is used for server-side validation (and to generate the html5 data atribute).MinLengthwhere the passed value is a default value and when your custom attribute is called by server-side validation, you look in the http request to get the value returned by the dropdown. I don't know if it works, but it's a thing i would try if i had this need.