Programatically Create New Appointment With Custom Winforms Button Control.

2 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. DevCraft banner
Back to Top