Programatically Create New Appointment With Custom Winforms Button Control.

4 posts, 0 answers
  1. Chad
    Chad avatar
    11 posts
    Member since:
    Apr 2011

    Posted 23 Aug 2011 Link to this post

    hello, is it possible to have a button that when the user clicks it it opens a new appointment dialog and when they fill it out and click OK the Collection_Updated event fires in the scheduler just as if they had double clicked a date and added the appointment ?

    i have it working except the event does not fire, here is an example of how i am opening the dialog, DoctorAppointment inherits from EditAppointmentDialog

    DoctorAppointmentEditForm frm = new DoctorAppointmentEditForm();
                frm.practiceid = 1;
                frm.LoggedInUserID = this.LoggedInUserID;
                frm.PracticeListView = this.radPracticeView;

    i must be missing something!
  2. Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 25 Aug 2011 Link to this post

    Hello Chad,

    I am not sure I completely understand your scenario, however, there are two possibilities:

    Since you inherit from the default EditAppointmentDialog, you might want to prevent it from showing and display your dialog instead. This can be achieved by handling the AppointmentEditDialogShowing event of RadScheduler:

    void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
        e.AppointmentEditDialog = new DoctorAppointmentEditForm();

    In the other case, if you are showing your dialog manually (for example, on a button click),  then you should also add the newly created appointment manually to the scheduler. You can do this by using RadScheduler's Appointments collection:


    In case the form inherits from EditAppointmentDialog, you can call its EditAppointment method before displaying it and it should handle these operations automatically:

    DoctorAppointmentEditForm frm = new DoctorAppointmentEditForm();
    frm.practiceid = 1;
    frm.LoggedInUserID = this.LoggedInUserID;
    frm.PracticeListView = this.radPracticeView;
    frm.EditAppointment(null, this.radScheduler1);

    If you pass null as first argument to the EditAppointment method, the dialog will create a new appointment. If you pass an existing appointment instead of null, the dialog will edit this appointment.

    I hope this is useful. In case this does not cover your scenario, please send me with a more detailed explanation of your requirements. This will let me provide you with accurate answers.

    Do not hesitate to ask if you have any additional questions.

    Best wishes,
    Ivan Todorov
    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. Carole
    Carole avatar
    2 posts
    Member since:
    Oct 2014

    Posted 12 Nov 2018 Link to this post

    hi all ,

    i succeeded to create a new appointment through button click , but the problem is the radscheduler collection is not changing , as if nothing new is added and no appointment is added on the form . 

    this is the code i am writing :

     private void new_btn_Click(object sender, EventArgs e)

              appointmentDialog = new CustomEditAppointmentDialog();
              appointmentDialog.EditAppointment(new OutlookLikeAppointment(), this.radSchedulerDemo);



    can you help me out ?


  4. Dimitar
    Dimitar avatar
    2818 posts

    Posted 13 Nov 2018 Link to this post

    Hi Carole,

    This way you are passing a new appointment that is not referenced anywhere and the dialog is not connected to the scheduler in any way. You need to use the AppointmentEditDialogShowing event and pass your dialog when needed. The following article shows the complete example of this: EditAppointmentDialog | RadScheduler.

    I hope this will be useful. 

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top