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

Validation when adding new row

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Licenses
Top achievements
Rank 1
Licenses asked on 13 Oct 2010, 04:58 PM
Hello,

When adding a new row, and the user enters a value in the cell that is not valid, it becomes impossible to leave this cell. The user can leave this cell when clicking escape twice, but this is not an option. Because of this behaviour, it is very hard to cancel a newly created, invalid, row. When looking into this, I noticed a property ActionOnLostFocus that can be set to "CancelEdit" or "CommitEdit". When I set this to "CancelEdit", the following behaviour occurs: A new item has 3 properties shown in the grid. Every property is required. The user fills in the first value, tabs to the next column, leaves this blank and tabs to the next column. I would expect the next cell would be editable, but instead, the whole row is deleted (cancelled insert). I believe this should not happen, because it occurs often that a user doesn't fill in the values from left to right, but sometimes skips a column (by pressing tab).

When looking deeper into the validation problems, I noticed that the property ValidatesOnDataErrors now has values "InViewMode" and "InEditMode". What do these values mean, because I cannot find any documentation about this? "InViewMode" looks like it solves my problem. Now the user can "get out" of the invalid cell and do some other stuff in the view. When saving, the validation error is shown. So this looks very promising, but I would like to have more information about this feature. Not even Google could help me with this :-)

Thanks

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 14 Oct 2010, 10:12 AM
Hello Sodi We,

When "ValidatesOnDataErrors" is set to InViewMode then data validation usually via INotifyDataErrorInfo and IDataErrorInfo interfaces will be performed only when cell is in view mode. This means that when cell is in edit mode data validation will not be performed. The default value of this property is both InViewMode and InEditMode.

Unfortunately I cannot simulate the problem related to ActionOnLostFocus. Maybe the row editing is canceled because in any reason focus leaves this new row. New row has its own ActionOnLostFocus and if it is not set gets the value from RadGridView.ActionOnLostFocus.
I hope this will help.

Regards,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Licenses
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or