11 Answers, 1 is accepted
Have you tried CancelEdit() method of the grid?
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Could you please provide me with a little bit more information about your scenario and what are you trying to achieve?
Thank you in advance.
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
We will consider adding a public API for "Cancel cell edit", meanwhile you could execute RadGridViewCommand.CancelCellEdit command via code behind.
RadGridViewCommands.CancelCellEdit.Execute(
null
);
This will cancel edit of the current cell and it is what RadGridView performs when Esc key is pressed.
Let me know if this doesn't help. Greetings,
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
RadGridViewCommands.CancelCellEdit.Execute(
null
);
Thank you,
Could you take a look at this article ? Is that example you are looking for ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
When I try the following code:
RoutedUICommand cancelCellEdit = RadGridViewCommands.CancelCellEdit.Execute(null) as RoutedUICommand;
cancelCellEdit.Execute(null, this.radGridView);
I am getting a boxing and unboxing error at compile time. Is there some other kind of software pattern I need to use?
The compile time error:
Error 136 Cannot convert type 'void' to 'System.Windows.Input.RoutedUICommand' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
Can you try defining your command as follows:
var cancelCellEdit =
RadGridViewCommands.CancelCellEdit
as RoutedUICommand;
cancelCellEdit.Execute(null, this.clubsGrid);Regards,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
But the grid is tabbing to the next cell. Is there a way to invoke a command to prevent that as well?
What you can try is to set the cell whose editing you just cancelled and set it as current again. Will that approach meet your requirements ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>