开发者

Multiple Validation Items on a Single Property

开发者 https://www.devze.com 2023-04-11 12:21 出处:网络
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 inc

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号