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

<ESCAPE> doesn't always exit editing - should it?

1 Answer 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lynne
Top achievements
Rank 1
Lynne asked on 01 Nov 2011, 04:23 PM
I have a grid bound to an Entity Framework-based CollectionViewSource.

For the sake of this example, my columns (left->right) are:
  • Name - in the database this is required, unique, and non-Null
  • Serial # - a string

I'm getting an exception when trying to escape editing a new line
  1. Press <click here to add new item>
  2. Type in a name
  3. press <TAB> to advance to serial # column and type in a serial number
  4. press <BACKTAB> to move focus to Name column
  5. delete everything in the Name field that you just entered
  6. Press <ESCAPE> once
My Entity Framework code throws an exception in the Device.Name property setter because it's been passed a Null.

I was under the impression that pressing <ESCAPE> was supposed to exit editing mode and pressing it twice on a new line was supposed to discard it.  That (the latter) does happen if I've entered no data in the columns or valid data.  If I continue (and ignore the exception), the new row is discarded, but I'm concerned because I don't understand what's happening.

When pressing <ESCAPE>, neither the row or cell validation methods are called, which makes sense.

Why is the RadGridView attempting to update the underlying data when it's about to be discarded?



1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 04 Nov 2011, 03:02 PM
Hello Lynne,

The problem comes from the fact that you entered a name and you are trying to delete it. RadGridView has to store the value to the underlying property which happens when first TAB is pressed.
Perhaps this error message is showed by a code inside Name property setter (when new value is string.Empty or null), which happens when first Escape is pressed.

Let me know if there is something unclear.

Kind regards,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Lynne
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or