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

2 posts, 0 answers
  1. Suraj
    Suraj avatar
    4 posts
    Member since:
    Aug 2013

    Posted 05 Nov 2013 Link to this post

     
    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();
            }

  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 07 Nov 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top