Multiple Validation Items on a Single Property
I am trying to fix a validation problem where only a single error message is displayed. The idea for the application the user will be creating a product, and in the process, will have the option to include a picture of the product.
There are certain restrictions on the type, file size, and dimensions, of the image. Yet with the validation model I am using, only one error message ever gets displayed. How would I go about including more than one error message for a single field?
Code for the property in question:
[LocalizedDisplayName(typeof(StoreManagementRes), "Image")]
[ImageSize(typeof(BesLogicSharedRes),"ValidationImageFileSizeMustBeLessThan20kb")]
[ImageDimension(typeof(BesLogicSharedRes), "ValidationImageDimensionMustBeLessThan640x480")]
[ImageType(typeof(BesLogicSharedRes), "ValidationImageTypeMustBeJpgOrPng")]
public int ImageFileId { get; set; }
开发者_高级运维
The idea is to present to the user all the areas where validation fails.
精彩评论