I\'ve been working in WebForms for years but I\'m fairly new to .NET\'s flavor of MVC. I am trying to figure out how to apply dynamic validation rules to members of my model
I havent been working with MVC4 for a long time, so forgive me if i am wrong, but you can server side and client side validation using jquery-val (already available to you if you used the "internet application" template when creating your project) and attributes:
public class Device
{
public int Id {get; set;}
public ICollection Settings {get; set;}
}
public class Setting
{
[Required]
public int Id {get; set;}
[Range(1,10)]
public string Value {get; set;}
[Required]
public bool IsRequired {get; set;}
public int MinLength {get; set;}
public int MaxLength {get; set;}
}