asp.net mvc - Model validation using db value in Range -
i have 2 tables, campaign , advert 1 many relationship. during advert creation, user selects pre-defined campaign advert belong. campaign has rrp money field , advert has saleprice money field. i'm after way ensure submitted advert.saleprice >= chosen campaigns rrp.
can done in model? along lines of in advert_validation? possible fill values of range method calls?
[range(0, getcampaignrrp(), errormessage = "value must equal or greater campaign rrp")] public double saleprice { get; set; }
or need check @ controller level? appreciated!
thanks all,
jay
you can use new remote
attribute. calls action , returns true or false. here's link example.
Comments
Post a Comment