in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Access to DxErrorProvider Counts / Events

Last post 5/16/2007 12:06 PM by Andrew Burns. 2 replies.
Page 1 of 1 (3 items)
Sort Posts:
Previous Next
  • 5/4/2007 12:21 PM

    Access to DxErrorProvider Counts / Events

    I have a DxErrorProvider on my form (layoutControl) and it is worrking correctly, I can set or unset the error. My problem is that there is no way that I can tell if there are any errors on my form.

    I am trying to accomplish two things:

    1) When an error state is changed (Set or unset, type changed, etc) (Basically any call to SetError) I would like to update my OK button in accordance if the form is valid or not (Enabled, Disabled)

    2) Access the total number of error and/or get a list of controls that have some error condition or better yet by condition type (Critical, Warning, etc)

    Am I missing something? Does anyone have any similar experiances? I am thinking about creating my own control based on the DxErrorProvider to expose the required features.

    Filed under:
  • 5/15/2007 7:00 AM In reply to

    Re: Access to DxErrorProvider Counts / Events

    You have go through all controls and check their errors:

    hier is an example

     

                    foreach (Control control in gcCustomer.Controls)
                        if (dxErrorProviderCust.GetError(control) != string.Empty && dxErrorProviderCust.GetErrorType(control) == ErrorType.Critical)
                        {

                            //There is an error with type critical
                            return false;
                        }

                    return editCustomer.IsDirty;

     

    This is just some code which simply shows you how to get error and error type for a control.

    I think this is what you meant, if not please explain.

    B.Celik 

  • 5/16/2007 12:06 PM In reply to

    Re: Access to DxErrorProvider Counts / Events

    That is insanely inefficient,e specially if you just want to get the number of each condition.

     What I ended up doing is creating a utility class that uses reflection top pull back the hashtable that the DxErrorProvider uses internally and return the information from there.

     
    I know I could have built a new version of the control, but the way I see it the utility class will be easier to maintain with future DX updates.

     
    Thank you for the response. I would recommend that in future releases they add methods to get counts and possibly the errorItems as this could would be relatively easy to write.
     

Page 1 of 1 (3 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED