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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -