c# - Compare two input fields in asp.net mvc -


this question has answer here:

i have 2 properties in model class:

public datetime startdate { get; set; } public datetime enddate { get; set; } 

here,startdate should less enddate there data annotation in asp.net mvc

there option write own custom attribute, shown in this answer.

another option use foolproof (available nuget).

public class eventviewmodel {     [required]     public string name { get; set; }      [required]     public datetime start { get; set; }      [required]     [greaterthan("start")]     public datetime end { get; set; } } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -