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

custom commands - 'RaiseCanExecuteChanged'

3 Answers 81 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
jen
Top achievements
Rank 1
jen asked on 21 Mar 2013, 03:41 PM
I have a radDataform and I'm customizing the Commands using the DataFormCommandProvider.

In edit mode, when I change a property in my current item, I do some validation, and add or remove ValidationErrors manually.
At this point I need the Commit button to re-run its CanCommitEditExecute() logic, to realize it can't commit while there are validation errors.

How do i trigger the CanCommitEditExecute() logic to re-run?
if it were a DelegateCommand I would just call RaiseCanExecuteChanged() on it, but I can't find anything like that here.

thanks

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 26 Mar 2013, 05:06 PM
Hi,

 We are using CommandManager, so that CommandManager.InvalidateRequerySuggested should do the trick. May, I ask you to try it on your side?

All the best,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
jen
Top achievements
Rank 1
answered on 26 Mar 2013, 07:20 PM
Thanks Ivan,
but DataFormCommandProvider doesn't have public access to anything called .InvalidateRequerySuggested()

I have found a way around needing this. Instead of updating the buttons, the user can click commit, it will go through validation, then stay in edit mode if the validation fails.
0
Ivan Ivanov
Telerik team
answered on 28 Mar 2013, 02:30 PM
Hello,

 I have prepared a sample project for you. It is attached for your reference.

All the best,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
jen
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
jen
Top achievements
Rank 1
Share this question
or