DataError event like in DataGrid

2 posts, 0 answers
  1. Maurizio
    Maurizio avatar
    43 posts
    Member since:
    Jan 2012

    Posted 01 Jun 2012 Link to this post

    Hi Telerik Team,

    is it planned that an updated Version of RadDataForm will expose a "DataError" event just like the RadDataGrid?

    I am binding the RadDataForm to a customized Telerik.Windows.Data.QueryableCollectionView (overriding AddNew(), CommitNew(), CommitEdit(), etc.), which internally binds to a custom database repository-class. Everything works fine so far, but the DataForm fails to handle exceptions occuring after calling CommitEdit() or CommitNew(). E.g. RadDataForm calls CommitNew(), the repository tries to insert the new item into the db, then a "unique constraint" or other DB-error occurs, the dataform crashes.  With DataGrid the approach works fine, as i subscribe the DataError event and handle the exception properly.
    The only workaround now is, to catch the exception inside the CommitNew() / CommitEdit() method of the custom CollectionView() and call CancelNew() / CancelEdit() inside the catch-block. However this way the DataForm does not show an error to the user.
    Using validation rules is no solution either, as some errors only occur when actually trying to insert / update an item in the database.

    Best regards
  2. Ivan Ivanov
    Ivan Ivanov avatar
    1117 posts

    Posted 06 Jun 2012 Link to this post


    We have not planned to introduce a similar event in RadDataForm for now. However, I believe that there is an easy workaround to tackle this. RadDataForm enables its users to add their own validation errors, through the myRadDataForm.ValidationSummary.Errors property. So, you can catch the constraint exception and "translate" it  to your own validation error. Please, be advised that when user-defined validation errors are utilized, a custom Add/Remove errors logic should be implemented, as RadDataForm won't remove them on any circumstances.

    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
Back to Top