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

OK button event

3 Answers 88 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Smiljan
Top achievements
Rank 1
Smiljan asked on 30 Mar 2015, 11:19 AM
Hi!

I modified appointment edit/insert form with my own custom fields.

 Everything works OK (saves all the extra data in my custom fields), but I've added extra button on the form and I need to "tap into" default save event.

 For example - default OK button saves data from all controlls to database. I want for the new button to do the same, but in the process I write some new vaules in my custom fields and for that I need new button (which would set new values in certain controls and default save event would then save alltogether - "ApplySettingsToEvent").

Thank you for any kind of info.

BR, Smiljan

3 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Apr 2015, 09:06 AM
Hello Smiljan,

Thank you for writing.

In order to perform the same logic as the OK button in your custom button's Click event you can call the EditAppointmentDialog.buttonOK.PerformClick method:
public partial class CustomAppointmentEditForm : EditAppointmentDialog
{
    public CustomAppointmentEditForm()
    {
        InitializeComponent();
    }
 
    private void radButton1_Click(object sender, EventArgs e)
    {
        this.buttonOK.PerformClick();
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.
 
Regards,
Dess
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Smiljan
Top achievements
Rank 1
answered on 03 Apr 2015, 06:30 AM
Hi!

Works great!
It's worth to mention that if you set default (inherited) OK button to Enbled=false, then also buttonOK.PerformClick method won't fire.
In this case you have to use Visible=False insetad Enabled=False.

Tnx again.
BR, Smiljan
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Apr 2015, 09:18 AM
Hello Smiljan,

Thank you for writing back.

It is desired behavior when a RadButton is disabled and calling the PerformClick method does not fire its Click event. As you have already found out, you should hide the RadButton instead of disabling it.

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Scheduler and Reminder
Asked by
Smiljan
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Smiljan
Top achievements
Rank 1
Share this question
or