custom commands - 'RaiseCanExecuteChanged'

4 posts, 0 answers
  1. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 21 Mar 2013 Link to this post

    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
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 26 Mar 2013 Link to this post

    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.

  3. DevCraft banner
  4. jen
    jen avatar
    63 posts
    Member since:
    Jun 2009

    Posted 26 Mar 2013 Link to this post

    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.
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 28 Mar 2013 Link to this post

    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.

Back to Top