Dynamicdata Validation Exception Message Caught in JavaScript, not DynamicValidator
Posted
by Perplexed
on Stack Overflow
See other posts from Stack Overflow
or by Perplexed
Published on 2010-02-12T18:05:18Z
Indexed on
2010/04/05
2:43 UTC
Read the original article
Hit count: 490
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?
© Stack Overflow or respective owner