masha reznik
Top achievements
Rank 1
masha reznik
asked on 12 Mar 2010, 10:42 PM
Hello,
how i can cancel edit cell (reset value) when validation is failed?
Masha
how i can cancel edit cell (reset value) when validation is failed?
Masha
3 Answers, 1 is accepted
0
Accepted
Hello masha reznik,
Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You could use the CellValidating event to determine when validation has failed and cancel the edit:
private
void
RadGridView_CellValidated(
object
sender, GridViewCellValidatedEventArgs e)
{
if
(e.ValidationResult.ErrorMessage !=
null
)
{
this
.myGrid.CancelEdit();
}
}
Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jeff
Top achievements
Rank 1
answered on 17 Nov 2016, 01:29 PM
Hi Milan,
I'm using Telerik Gridview 2015.3.930.40 and the GridViewCellValidatedEventArgs seems to have changed to CellValidatedEventArgs and doesn't have the ValidationResult property.
I want to cancel the edit and rollback to the old value. Should I do my validation and rollback in an other event that is raise before CellValidated and CellValidating?
0
Hi Jeff,
When the user tries to commit an edit, the first event that is raised is the CellValidating one. So, you can use it and implement your validation logic as demonstrated in the Validating help article. When a given value is considered as invalid, you can call the CancelEdit method of RadGridView.
Hopefully, this helps.
Regards,
Stefan X1
Telerik by Progress
When the user tries to commit an edit, the first event that is raised is the CellValidating one. So, you can use it and implement your validation logic as demonstrated in the Validating help article. When a given value is considered as invalid, you can call the CancelEdit method of RadGridView.
Hopefully, this helps.
Regards,
Stefan X1
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.