简体   繁体   中英

MVC 2.0 Validation Summary groups

I have 3 portals on the view (one form) with one submit button. I need to have validation summary for each of this portals. Is there any way have validation groups fro summary validations like in asp.net? I was thinking that if i put Htm.Validation Summary on each portal it will validate only inputs for this portal, but it is not, all ValidationSummary helpers on the page frernig for all inputs and in result i have three places on the page where displaying the same validation errors. Is there any way to say to validationsummary which partials/inputs to validate, kind of like validationsmmary groups behavior in asp.net

The ValidationSummary methods don't have any facility for discriminating between different partial views. One solution would be to create your own extensions which accept a filter parameter and add the ModelState errors yourself using a name you can pass to your extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM