asp.net mvc - MVC5 DataAnnotations - Accept Specific Numbers -


how can set viewmodel accept specific values data annotation? example, want input values form 2 or 4. i'm looking [range(2, 4)], still accepts numbers in between. want list specific numbers accept.

[required] public int numberparticipants { get; set; } 

also looking same thing strings.

[regularexpression("^(2|4)$", errormessage = "please enter 2 or 4")] 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -