Commit button and ICommand

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 23 Aug 2011 Link to this post

    I have currently a button on my page to commit the changes that the user has implemented using the DataForm.
    It sort of seams a little redundant as the end user makes the change then clicks commit and then has to click Save changes.
    I would like to bind the command directly to the commit changes button.
    Is that possible?

    Right now, i have this im my view model:

    public ICommand SaveChangesCommand { get; set; }
    SaveChangesCommand = new DelegateCommand(SaveChanges, CanSaveChanges);
    private bool CanSaveChanges(object param)
            {           
                return true;  
            }
      
            private void SaveChanges(object param)
            {
                _organisations.SubmitChanges();
            }
    When it comes down to it i simply want the _organisation.SubmitChanges() to be called when i click the commit button.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 23 Aug 2011 Link to this post

    Hi Andrew,

     Do you mean that you have a button after that DataForm?

    If this is the case, then I have prepared a sample project showing how to call a command on a button click. I have used one RadDataForm and 1 Button right after it.

    Please check the attached sample project and let me know is this is what you need.

    Regards,
    Didie
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 23 Aug 2011 Link to this post

    No, i mean just the opposite.
    I have a button that is wired to a command.
    I don't want it.
    I want the command to execute after the commit button on the datafrom has been clicked.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 23 Aug 2011 Link to this post

    Hi Andrew,

     The fact that you want to change the Command's logic to be executed by the in-build Commit button makes the things little bit more difficult.

    I am attaching a sample project showing how this could be implemented. Please, refer to the suggested example approach.

    Regards,
    Didie
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top