c# - CustomAttribute that validates 2 fields -


so have these 2 input fields fromdate , todate,

in mvc want create customattribute ensure fromdate before todate.

is possible? if how? or alternative?

thanks

mvc foolproof validation great way go this. operates on server side reference , propagates client side script include.

http://foolproof.codeplex.com/

here example of attribute in action:

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

see greaterthan attribute on date. save having write yourself.

you can nuget project: http://nuget.org/packages/foolproof

pm> install-package foolproof 

i hope helps.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -