This is a migrated thread and some comments may be shown as answers.

DataError event like in DataGrid

1 Answer 89 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Maurizio
Top achievements
Rank 2
Maurizio asked on 01 Jun 2012, 01:03 PM
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

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 06 Jun 2012, 02:03 PM
Hi,

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.

Greetings,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
DataForm
Asked by
Maurizio
Top achievements
Rank 2
Answers by
Ivan Ivanov
Telerik team
Share this question
or