Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > DataForm > Does form have validation errors?

Not answered Does form have validation errors?

Feed from this thread
  • Jeff avatar

    Posted on Mar 26, 2012 (permalink)

    I have a user control that contains a RadDataForm and a button.

    The button is bound to a custom command that has xxx_CanExecute() and xxx_Executed() methods defined.

    I want xxx_CanExecute() to set e.CanExecute to false, if the form has any validation errors.  I'm getting the user control passed as sender, and from that I can get a reference to the RadDataForm.  But I can't for the life of me figure out how to tell if the form has any validation errors.  In the debugger I can see a validationErrors collection on the form, but that seems to be private. ValidateItem() always returns true, regardless.

    Seems to me that I'm missing something simple.  Can someone point me in the right direction?

    Reply

  • Maya Maya admin's avatar

    Posted on Mar 29, 2012 (permalink)

    Hi Jaffrey,

    You can try getting access to the ValidationSummary of RadDataForm and work with its HasErrors property.
    For example: 

    var hasErrors = this.DataForm1.ValidationSummary.HasErrors;
     
    Will that approach be suitable for your scenario ? 

    Kind regards,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Jeff avatar

    Posted on Mar 29, 2012 (permalink)

    That looks like what I was looking for.  Thanks.

    Reply

  • Jeff avatar

    Posted on Apr 6, 2012 (permalink)

    I'm not sure whether it's a bug, or but ValidationSummary.HasErrors always seems to be false.

    I made a simple test page, and I'm seeing ValidationSummary.Errors.Count() increment, when I type invalid content into a textbox, and I'm seeing the validation error display at the bottom of the form, but HasErrors is still false.

    Still, "Errors.Count() > 0" will work for my purposes.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > DataForm > Does form have validation errors?