Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
ValidationError Event & Validate() conflict?
posted

Hi -

I've been playing with the WinValidator in a test app; one scenario that is causing me issues which is baflling to me is this:

I have a texteditor associated to a validator - IsRequired. Very simple. I'm also handling the ValidationError event with a switch just like in the docs. That ALL works fine. However, when I call the Validate() method in my Save button click, the ValidationError event fires, but then fails on an invalid object reference to the e.Control.Name in the switch. Note: this event runs fine if fired by the control itself.

How would you then handle the ValidationError event, yet STILL be able to explicity call Validate just prior to saving a form??

Parents
  • 280
    posted

    I *think* I may have found the solution... is it to check the ValidationErrorEventArgs prop IsSingleEntityValidation and if false, then exit out? That's the only thing I could get to make the above scenario work.

    ALSO - what's the best way to do custom code validation and still tap into using the validator and it's notificationsettings for showing and icon/tooltip etc? Is it to leave the default trigger of OnValidating, then in whatever control you want to add custom logic, use GetValidationSettings and set props appropriate to your custom logic?

     

Reply Children