RequiredIf Validation Attribute for Boolean, String and FileUpload
Could someone write me an example of a Validation Attribute that validates
a Dependent field that could be Boolean, String or a HttpPostedFile value.
I've been looking but the examples that I've tried don't work for all
those situations. e.g
E.g. 1 if UseReferenceId is false then use department image
public bool UserReferenceId { get; set; }
[RequiredIf("UseReferenceId", false, ErrorMessage="Error please select a
Advert image")]
public HttpPostedFileBase DepartmentImageFile { get; set; }
E.g 2
[RequiredIf("AdvertLink", "*", ErrorMessage="Please enter a url for the
Image")]
public HttpPostedFileBase AdvertImageFile { get; set; }
[RequiredIf("AdvertImageFile", "*", ErrorMessage="Error please select a
Advert image")]
public HttpPostedFileBase AdvertLink { get; set; }
No comments:
Post a Comment