Modify Asp.Net Core MVC data annotations within the application

406 Views Asked by At

I am building an application using ASP.NET Core MVC and I have the requirement of having dynamic Data annotations for some fields. For instance, the data annotation [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long", MinimumLength = 3)] I am using on an input type text, in some cases when the page is open must be 3 in other cases it must be 6.

How can I achieve this dynamically?

0

There are 0 best solutions below