动态数据验证异常消息在 JavaScript 中捕获,而不是在 DynamicValidator 中捕获
我这里有一个页面,上面有一些列表视图,这些视图都绑定到 Linq 数据源,并且它们似乎工作得很好。
我想添加验证,以便在选中复选框(对象上的 IsVoid)时,必须输入注释(对象上的 VoidedComments)。
下面是绑定对象的 OnValidate 方法:
partial void OnValidate(ChangeAction action)
{
if (action == ChangeAction.Update)
{
if (_IsVoid)
{
string comments = this.VoidedComments;
if (string.IsNullOrEmpty(this._VoidedComments))
{
throw new ValidationException("Voided Comments are Required to Void an Error");
}
}
}
}
尽管页面上有一个动态验证器引用与动态控件相同的 ValidationGroup,但当异常触发时,它会被 JavaScript 捕获并且调试器想要中断。该消息永远不会传递到 UI正如预期的那样。
关于发生了什么事有什么想法吗?
I have a page here with a few list views on it that are all bound to Linq data sources and they seem to be working just fine.
I want to add validation such that when a checkbox (IsVoid on the object) is checked, comments must be entered (VoidedComments on the object).
Here's the bound object's OnValidate method:
partial void OnValidate(ChangeAction action)
{
if (action == ChangeAction.Update)
{
if (_IsVoid)
{
string comments = this.VoidedComments;
if (string.IsNullOrEmpty(this._VoidedComments))
{
throw new ValidationException("Voided Comments are Required to Void an Error");
}
}
}
}
Despite there being a dynamic validator on the page referencing the same ValidationGroup as the dynamic control, when the exception fires, it's caught in JavaScript and the debugger wants to break in. The message is never delivered to the UI as expected.
Any thoughts as to What's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我在这里找到了答案:
http://forums.asp.net/t/1476131。 aspx
链接
我们必须为 DD4 和 ASP.NET 4 使用新的改进的动态验证器。
I think I found the answer here:
http://forums.asp.net/t/1476131.aspx
Link
We will have to use a new ImprovedDynamicValidator for DD4 and ASP.NET 4.