Programmatically Open EditAppointmentDialog

8 posts, 0 answers
  1. Angus Cheung
    Angus Cheung avatar
    13 posts
    Member since:
    Aug 2009

    Posted 02 Oct 2009 Link to this post

    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

  2. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 05 Oct 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Angus Cheung
    Angus Cheung avatar
    13 posts
    Member since:
    Aug 2009

    Posted 05 Oct 2009 Link to this post

    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
  5. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 08 Oct 2009 Link to this post

    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.
  6. Angus Cheung
    Angus Cheung avatar
    13 posts
    Member since:
    Aug 2009

    Posted 11 Oct 2009 Link to this post

    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
  7. Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 13 Oct 2009 Link to this post

    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.
  8. Brennan
    Brennan avatar
    5 posts
    Member since:
    Jul 2010

    Posted 07 Sep 2010 Link to this post

    Is printing still not supported in Q2 2010 SP1?
  9. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 10 Sep 2010 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready