-1

I have DataGrid and during a cell edit, a validation error occurs (my binding throws an exception and the error is correctly displayed to the user). The user then chooses to just click somewhere (either to navigate to a different portion of my application or to end the edit) and I want to cancel the edit. However, when there is an active validation error, the data grid refuses to end the edit - this means I cannot manipulate the grid items in any way until the user either enters a valid value or presses the Escape key.

What can I do to programmatically end the edit or is there not way to do it other than to either try and programmatically send the Escape key or programmatically orchestrate value entry to reset the value?

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
  • are you using the default silverlight grid? – Jonathan D Sep 28 '11 at 15:55
  • @JonathanD: Yes. I investigated further since posting this and to my knowledge, an edit that has a validation error cannot be ended with code - the user has to do it. – Jeff Yates Sep 28 '11 at 18:05
  • i use the telerik rad grid and you can create you own column in that which you could cancel the error. i have done this my self in that. however it would mean splashing out on telerik controls which is a fare bit of money – Jonathan D Sep 28 '11 at 21:43
  • I wonder why the downvote. :( – Jeff Yates Feb 01 '16 at 16:56

1 Answers1

1

For your instance of the data grid call cancel edit: dataGrid.CancelEdit()

user302084
  • 176
  • 1
  • 7
  • Unfortunately, this doesn't work when there are validation errors. The documentation even states that edit mode cannot be ended when there are validation errors. – Jeff Yates Oct 03 '11 at 23:04