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

How can i get the start and end time of clicked appointment

1 Answer 68 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Suraj
Top achievements
Rank 1
Suraj asked on 05 Nov 2013, 01:55 PM
 
Hi I am very new to Scheduler control can anyone tell me how do i get start and end time  and also date  when i select the  the time say 4 pm in the code behind and then wheni save and when i try to retrieve it i am getting different time  this is how i am doing can any one tell me what is the problem
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <div class="exampleContainer">
        <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" DayStartTime="08:00:00"
            DayEndTime="18:00:00" TimeZoneOffset="03:00:00" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
            OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
            
            DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
            DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId"
            DataReminderField="Reminder" DayView-ReadOnly="False">
            <AdvancedForm Modal="true"></AdvancedForm>
            <TimelineView UserSelectable="false"></TimelineView>
            <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
            <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
            <Reminders Enabled="true"></Reminders>
        </telerik:RadScheduler>
    </div>

protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
        {
            Appointments.Add(new AppointmentInfo(e.Appointment));
            DateTime start = e.Appointment.Start;
            DateTime end = e.Appointment.Start.AddMinutes(((RadScheduler)sender).MinutesPerRow);
            string startdate = e.Appointment.Start.ToString();
        }

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 07 Nov 2013, 12:36 PM
Hello Suraj,

To get the start and end time of the appointment that you are inserting you can use the OnAppointmentInsert and the AppointmentUpdate server side events and the code below (you can also check the attached image file that demonstrates the properties that you can use)
protected void RadScheduler1_AppointmentInsert(object sender, AppointmentInsertEventArgs e)
    {
        var start= e.Appointment.Start.Date;
        var end = e.Appointment.End.TimeOfDay;
    }

Regards,
Kate
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Suraj
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or