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

Commit button and ICommand

3 Answers 54 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 23 Aug 2011, 12:03 PM

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.

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Aug 2011, 02:53 PM
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 >>

0
Andrew
Top achievements
Rank 1
answered on 23 Aug 2011, 03:11 PM
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.
0
Dimitrina
Telerik team
answered on 23 Aug 2011, 04:40 PM
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 >>

Tags
DataForm
Asked by
Andrew
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or