How do I end edit on cell with validation errors?

10 posts, 1 answers
  1. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 14 Dec 2010 Link to this post

    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?
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 14 Dec 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 15 Dec 2010 Link to this post

    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
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Dec 2010 Link to this post

    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
  6. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 15 Dec 2010 Link to this post

    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.
  7. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 16 Dec 2010 Link to this post

    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.
  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 20 Dec 2010 Link to this post

    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
  9. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 22 Dec 2010 Link to this post

    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.
  10. Answer
    Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 22 Dec 2010 Link to this post

    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
  11. Marius
    Marius avatar
    21 posts
    Member since:
    Oct 2010

    Posted 22 Dec 2010 Link to this post

    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 :-) )
Back to Top
UI for WPF is Visual Studio 2017 Ready