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

GridView Row Level Editing and Row Validation

1 Answer 37 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 20 Mar 2014, 08:32 PM
1. The RowValidating and RowValidated events do not fire when expected.
You have these events set to fire when the user changes rows. What happens when there is only one row in the grid? Expected behavior is to fire when the Row loses focus, which should happen when a user clicks anywhere outside the row, including whitespace or other controls on the form.

2. The data is saved before row validation is complete.
What is the point of having row-level validation if the values have already been saved to the databound object? Absolutely nothing should be saved until ALL validation is complete.

3. The user is locked down and unable to escape/cancel the edit if the row validation actually gets called and fails. 
This is extremely poor design. You cannot expect a user to be able to fix the issue every time. Sometimes they will need to start over, especially if there is a large amount of data. Instead, you lock them down and force them into making changes they may not want to commit to.

These problems have been around for years, but nobody has taken the time to address them despite promises. Even worse, the links to the Feature Requests in these threads no longer work and Telerik has changed their stance from admitting the problems to claiming that these are "desired behaviors" and "features". Stop calling these behaviors features, they are most certainly not.

http://www.telerik.com/forums/what-event-s-is-are-fired-when-the-pencil-icon-is-clicked

http://www.telerik.com/forums/radgridview---save-changes-to-a-rows-data-back-to-database

http://www.telerik.com/forums/cancel-row-edit

http://www.telerik.com/forums/in-rowvalidating-e-row-ismodified-doesnt-show-as-true-when-it-should


http://www.telerik.com/forums/radgridview-rowvalidating-event

http://www.telerik.com/forums/rowvalidating-not-firing

http://www.telerik.com/forums/rowvalidating-event-missing

http://www.telerik.com/forums/rowvalidating-problems

http://www.telerik.com/forums/esc-in-gridviewdatetimecolumn-inside-raddatagridview-after-i-did-an-e-cancel-true-in-row-validation


http://www.telerik.com/forums/how-to-validate-row-data

http://www.telerik.com/forums/rowchanged-question

http://www.telerik.com/forums/how-to-prevent-empty-rows-creation

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 25 Mar 2014, 04:28 PM
Hi Jeff,

Thank you for writing.

1. RowValidation events are fired when the current row in the grid is changed, or when the control looses focus. This is desired behavior. You mention that you want the event to fire when the row "looses focus". Losing the focus for the row would mean that it is no longer current. So, to trigger the event when you click on the white space below the grid, you can set the control's CurrentRow to null to force the event to fire (if you want you can restore the current row afterwards). Here is an example of this: http://www.telerik.com/forums/what-event-s-is-are-fired-when-the-pencil-icon-is-clicked#LvgAcZBApUaJCqq4MMVrug.

Clicking other controls in the form, will trigger the event as this would cause RadGridView to loose focus. However, clicking on the form itself will not, as the control will not loose focus. Again, this case can be handled by using the aforementioned approach.

2. For the time being, the entire grid is built on a way that each cell value change is submitted to the underlying object. Imagine a case where you have 50 columns, you edit 49 and the app crashes. If the values are not committed you have wasted all this data. Furthermore, this is the way the standard .NET grid behaves as well, so we consider this is the correct behavior in this case, hence we built the grid to work this way.

3. We are not locking down the users. We do provide the means to disallow the user to leave the cell/row when there is data that they have to correct. In this post I have demonstrates how to use a flag to skip the row validation if escape is pressed.

I hope that the provided information addresses your inquiries. Let us know if you have any other questions or suggestions for other functionality/controls in the suite.

Regards,
Stefan
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Jeff
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or