I use the GridView in a fashion similar to your example in http://www.telerik.com/help/wpf/gridview-managing-data-add-new-entries.html:
My "DBUtility.AddEmployee" may return an exception due to a database constraint (e.g. duplicate key). Is there a suggested way to handle this? Any special event?
I would like the result to look approximately the same way as if I was using RowValidating and set the IsValid property to false.
Thanks.
private
void
radGridView_RowEditEnded(
object
sender, GridViewRowEditEndedEventArgs e )
{
if
( e.EditAction == GridViewEditAction.Cancel )
{
return
;
}
if
( e.EditOperationType == GridViewEditOperationType.Insert )
{
//Add the new entry to the data base.
DBUtility.AddEmployee( e.NewData );
}
}
My "DBUtility.AddEmployee" may return an exception due to a database constraint (e.g. duplicate key). Is there a suggested way to handle this? Any special event?
I would like the result to look approximately the same way as if I was using RowValidating and set the IsValid property to false.
Thanks.