4

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?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Perplexed
  • 123
  • 7
  • I am experiencing similar behavior and provided more details on the issue here, but no resolution yet: http://forums.asp.net/p/1585171/4005442.aspx Any ideas? Thank you. Tags: #DynamicValidator #LinqDataSource – Rami A. Aug 02 '10 at 19:29
  • By chance is your UI control contained within an update panel? – RSolberg Feb 12 '10 at 18:42

1 Answers1

1

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Rami A.
  • 10,302
  • 4
  • 44
  • 87