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

GridViewValidationMode between InViewMode and InEditMode

1 Answer 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Scott Waye asked on 26 Jan 2013, 05:39 PM
Hi,

What I would like regards validation of cells/rows and where the focus can go is to have both these rules at the same time:

1. Focus can move within the edited row regardless of whether cells are invalid - you get this with InViewMode.
2. User cannot leave the row if any cell is invalid - you only get this with InEditMode which means I cant get behaviour 1

Is it possible to have both 1 and 2 at the same time?

This is using RIA entities with DataAnnotations in case that makes a difference.

--
Scott

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 28 Jan 2013, 11:45 AM
Hello,

These both values a totally different in their state (and behavior), so they cannot be combined.
Unfortunately with RIA services the problem is a little bit more complex, since all built-in (RIA) validation is asynchronous by default. Usually if you set "InViewMode", then the end user will be able to move to another cell (even if the edited cell has an incorrect value due to some DataAnnotation attributes), but row (item) level validation is performed in an async way (via INotifyDataErrorInfo interface) and RadGridView cannot prevent user from leaving "the invalid" row (because there is no result from database yet). RadGridView will show the error (via INotifyDataErrorInfo), but the focus cannot be returned to this row.
However if you have all requirements you can perform a check inside RowValidatING event and stop the user from leaving the row.
Be aware that this check should be synchronous (does not include a call to the database), otherwise the method will be finished and you will not get the desired result.

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Scott Waye
Top achievements
Rank 2
Veteran
Iron
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or