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

Programatically Create New Appointment With Custom Winforms Button Control.

3 Answers 138 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 23 Aug 2011, 06:50 AM
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;
             
            frm.ShowDialog();
;

i must be missing something!

3 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 25 Aug 2011, 03:58 PM
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:

this.radScsheduler1.Appointntments.Add(myApp);

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);
 
frm.ShowDialog();

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 >>

0
Carole
Top achievements
Rank 1
answered on 12 Nov 2018, 11:13 AM

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);
            appointmentDialog.ShowDialog();

        }

 

can you help me out ?

Regards

0
Dimitar
Telerik team
answered on 13 Nov 2018, 09:18 AM
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. 

Regards,
Dimitar
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.
Tags
Scheduler and Reminder
Asked by
Chad
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Carole
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or