简体   繁体   English

MVC 2.0验证摘要组

[英]MVC 2.0 Validation Summary groups

I have 3 portals on the view (one form) with one submit button. 我在视图(一种表单)上有3个门户,其中一个提交按钮。 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? 有没有办法像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. 我当时在想,如果我在每个门户网站上放置Htm.Validation Summary,它将仅验证该门户网站的输入,但事实并非如此,页面frernig上的所有ValidationSummary帮助器都针对所有输入,结果我在页面上的三个位置显示了相同的验证错误。 Is there any way to say to validationsummary which partials/inputs to validate, kind of like validationsmmary groups behavior in asp.net 有什么办法可以说对validationsummary进行验证的部分/输入,类似于validations。

The ValidationSummary methods don't have any facility for discriminating between different partial views. ValidationSummary方法没有任何区分不同局部视图的功能。 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. 一种解决方案是创建自己的扩展,该扩展接受一个过滤器参数,并使用可以传递给扩展的名称自己添加ModelState错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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