c#, asp.net, dynamicdata Validation Exception Message Caught in JavaScript, not DynamicValidator (Dy
- by Perplexed
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 dynaimc 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?