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

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -