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

Programmatically Open EditAppointmentDialog

7 Answers 362 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Angus Cheung
Top achievements
Rank 1
Angus Cheung asked on 02 Oct 2009, 09:47 AM
Hello,

How can i open the EditAppointmentDialog programmatically? It is because i wanna update the database after the user clicks btnOK. Is this possible to get back dialog result?

Thanks,
Angus

7 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 05 Oct 2009, 02:45 PM
Hi Angus Cheung,

If you do not already have a custom appointment edit dialog you can handle AppointmentEditDialogShowing event of RadScheduler and from there get a reference to the default appointment edit dialog and handle its Closed event. Finally in this handler of the Closed event you can check the DialogResult and if it is OK, call your save logic. You will have to be careful so that you do not subscribe to the Closed event multiple times.

There is another approach that uses a custom appointment edit dialog. When the user pressed the OK button on the default appointment edit dialog, the ApplySettingsToEvent method is called. You can create a very simple inheriting dialog that overrides this method and place your code there as in the code snippet below:

public class CustomAppointmentEditDialog : EditAppointmentDialog 
        { 
            protected override void ApplySettingsToEvent(IEvent targetEvent) 
            { 
                base.ApplySettingsToEvent(targetEvent); 
                 
                //logic to save aappointment info here 
            } 
        } 
 
        private CustomAppointmentEditDialog customAppointmentEditDialog = null
 
        void radScheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e) 
        { 
            if (this.customAppointmentEditDialog == null
            { 
                this.customAppointmentEditDialog = new CustomAppointmentEditDialog(); 
            } 
            e.AppointmentEditDialog = this.customAppointmentEditDialog; 
        } 

However, you should note that changes to an appointment can happen not only when the user presses the OK button on the appointment edit dialog, but also when the user resizes or moves an appointment.

If you handle the CollectionChanged event of the Appointments collection of RadScheduler you will get notifications whenever an appointment changes, and this may be a better place for the saving logic.

Also, did you consider using the data binding functionality of RadScheduler for WinForms?

Kind regards,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Angus Cheung
Top achievements
Rank 1
answered on 06 Oct 2009, 04:42 AM
Hi Jordan,

Thanks for your reply.
Yup, the custom appointment edit dialog have been created. And the RadScheduler's AllowAppointmentMove and AllowAppointmentResize properties have been disabled. Also, data binding is used.

Simply, can i get the DialogResult of EditAppointmentDialog in the owner form? 

Thank you,
Angus
0
Jordan
Telerik team
answered on 08 Oct 2009, 04:27 PM
Hello Angus Cheung,

Yes, you can get the dialog result using the first approach that I suggested. Here is an example:
private bool subscribedToClose = false;
 
        void radScheduler_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
        {
            RadForm form = e.AppointmentEditDialog as RadForm;
            if (!this.subscribedToClose)
            {
                this.subscribedToClose = true;
                form.Closed += new EventHandler(form_Closed);
            }
        }
 
        void form_Closed(object sender, EventArgs e)
        {
            DialogResult result = (sender as RadForm).DialogResult;
        }

I was wandering why do you need to do this? Isn't the data binding functionality working well? Or do you have some other problem?

Best wishes,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Angus Cheung
Top achievements
Rank 1
answered on 12 Oct 2009, 04:10 AM
Hi Jordan,

Opps, It can get the DialogResult. However, the dataset does not have any change at that moment.
So, I cannot update the database in this situation.


It is because i want to update an other table after the user clicked Ok button. Also, for the data consistency in the multiuser environment, it is much easier to handle.

Besides, can the RadScheduler print out the chart directly?

Many thanks,
Angus
0
Jordan
Telerik team
answered on 13 Oct 2009, 06:07 AM
Hi Angus Cheung,

Thank you for the details.
Unfortunately, RadScheduler for WinForms does not currently have printing functionality.
 
Do not hesitate to write again if you have more questions or suggestions.

All the best,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brennan
Top achievements
Rank 1
answered on 07 Sep 2010, 10:28 PM
Is printing still not supported in Q2 2010 SP1?
0
Dobry Zranchev
Telerik team
answered on 10 Sep 2010, 05:55 PM
Hello Brennan,

Printing is still not supported, and the interest in this feature is rather low. When we collect enough votes we will consider its implementation. You can track its status here: 3362.

If you have other questions, feel free to contact us.

Sincerely yours,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler and Reminder
Asked by
Angus Cheung
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Angus Cheung
Top achievements
Rank 1
Brennan
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Share this question
or