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

How do I end edit on cell with validation errors?

9 Answers 472 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marius
Top achievements
Rank 1
Marius asked on 14 Dec 2010, 02:12 PM
I want to be able to move to the next cell or row although the current cell has validation errors but I cant seem to find a property to override the default behaviour. To be specific: I want to display validation but not restrict the user from moving to the next cell or row (or leaving the grid for that sake).

1) Is there a way to override this default behaviour?
2) If no, are there any plans to support this scenario?

9 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 14 Dec 2010, 04:16 PM
Hello Marius,

Please check this online demo. Does it behave as you wish?

Regards,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Marius
Top achievements
Rank 1
answered on 15 Dec 2010, 08:22 AM
The link does not work.

Just to clarify what I am trying to accomplish: The items bound in the GridView implements IDataErrorInfo and sometimes they return validation errors. I want to be able to commit changes (end edit) on a cell, regardless of whether the underlying bound item returns an error on not. The default (and I don't mind default as long as I can override default behaviour) is to force focus back to the cell so that the user can not move on before correcting the error. I find this behaviour user-unfrendly and specific to grids (ironically Microsoft have done the same, but I found a way to get around it). If you for example input an error value into a textbox (not in a grid), you are allowed to move to another control although the user might have introduced an invalid value, why should this be any different for grids?

Hope this clarifies what I'm trying to do
0
Veselin Vasilev
Telerik team
answered on 15 Dec 2010, 09:10 AM
Hello Marius,

I am sorry for the wrong link. The correct one is this:
http://demos.telerik.com/silverlight/#GridView/RowValidation

You can edit the Age column and the validation will fire, but you still be able to click on the other cells of the row.

All the best,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Marius
Top achievements
Rank 1
answered on 15 Dec 2010, 09:17 AM
It works as I want it to do within the same row, but not if you try to click outside the row that has validation errors. I want the ability to click on another row, instead of being forced to edit the row that has validation errors.
0
David Brenchley
Top achievements
Rank 1
answered on 16 Dec 2010, 09:11 PM
I wish to have the same functionality Marius is asking for.  I need to have an error display in a cell, but still allow a user to click on different columns and rows.
0
Veselin Vasilev
Telerik team
answered on 20 Dec 2010, 01:32 PM
Hi guys,

The possible solution then would be to use asynchronous validation as demonstrated here

Kind regards,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Marius
Top achievements
Rank 1
answered on 22 Dec 2010, 10:39 AM
I'm sorry, but that is not a good solution. I'm not going to remodel my domain and use async validation when its not required by the domain. The right approach would be to allow us as users to override the grid or column behavior and simply specify that the grid should not return focus to the current cell if the underlying binding returns validation errors. Instead of directing us to solutions which solves something else than what we are requesting I would appreciate a straight answer. Examples of answer I would find satisfying are:

1) We understand your request but we are not going to implement it due to bla bla bla
2) Its not currently supported, but we are looking into this for a future release...

It is much better to give an honest reply about what you are thinking about this feature instead of ignoring the fact that you are not supporting this and trying to shoe-horn us into using something else.
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 22 Dec 2010, 11:15 AM
Hi Marius,

Indeed validation logic by default returns focus to the first "wrong" cell of the edited row. You could override this behavior by using ValidatesOnDataErrors property (by default its value is InViewMode || InEditMode), which means that validation will be performed on every level. I think you will be satisfied by the result if you change ValidatesOnDataErrors property to InViewMode. This will allow you to exit edit mode, but cell will be marked as invalid in case there is an error returned by IDataErrorInfo interface (and of course if your item implements INotifyPropertyChanged also). This property could be set both on grid and on column level.
Let me know if this doesn't help.

All the best,
Nedyalko Nikolov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Marius
Top achievements
Rank 1
answered on 22 Dec 2010, 12:27 PM
Thank you, that works a lot better. I still think that it should be possible to validate and move on in edit mode, but this is good enough (for now :-) )
Tags
GridView
Asked by
Marius
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Marius
Top achievements
Rank 1
David Brenchley
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or