问题描述
我正在使用各种客户端验证规则,例如某些字段上的 Required
.我也有一些数据库验证规则,例如唯一需要在服务器端完成的唯一约束.我已经将错误消息冒泡备份到客户端,但是如何使用INotifyDataErrorInfo/ValidationSummary显示它们呢?
I have various client side validation rules I'm using such as Required
on certain fields. I also have some database validation rules such as unique constraints that really need to be done server-side. I've bubbled the error messages back up to the client, but how can I show them using INotifyDataErrorInfo/ValidationSummary?
如果可能的话,我希望这些错误显示在ValidationSummary控件以及导致错误的控件/属性中.这有可能吗?
If at all possible I'd like these errors to be shown in the ValidationSummary control as well as the control/property that caused the error. Is this even possible?
推荐答案
以下是解释异步验证的文章: http://weblogs.asp.net/fredriknormen/archive/2009/11/22/silverlight-4-and-asynchronous-validate-with-inotifydataerrorinfo.aspx
here is a post explain Asynchronous validation : http://weblogs.asp.net/fredriknormen/archive/2009/11/22/silverlight-4-and-asynchronous-validation-with-inotifydataerrorinfo.aspx
在您的情况下,您将必须将附加异步ValidationAttribute设置到Class本身上!(女巫会向您的对象添加验证错误)
in your case, you will have to set your additionnal asynchronous ValidationAttribute onto the Class itself ! (witch will add validations errors to your object)
这篇关于如何使用INotifyDataErrorInfo/ValidationSummary进行服务器端验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!