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

OnClientAppointmentInserting incorrect timeslot

1 Answer 47 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Gavin
Top achievements
Rank 1
Gavin asked on 31 Jul 2012, 04:07 AM

Hi,

I am trying to get the selected time range for a new appointment and am getting incorrect information passed into the OnClientAppointmentInserting method.  As shown in the screen shot "appointment selection.jpg" I select a time period of 10:30 am to 12:30 pm, I then right click and select new appointment.  When the OnClientAppointmentInserting method is fired the start time is now 12:00 pm and the end time is now 12:15 pm (see "timeslot.jpg").

Am I missing something or is this an issue with the OnClientAppointmentInserting event?

Thanks

Gavin.

Here is my code

<telerik:RadScheduler ID="rsAppointments" runat="server" 
                DataEndField="AppointmentEndDate" 
                DataKeyField="PatientAppointmentID"
                DataStartField="AppointmentStartDate"
                DataSubjectField="AppointmentTypeID"
                DataDescriptionField="AppointmentTypeID"
                Height="600px" MinutesPerRow="15" 
                onnavigationcomplete="rsAppointments_NavigationComplete"
                OnClientAppointmentInserting="OnInsertAppointment"
                OnClientAppointmentEditing="OnEditAppointment"
                GroupBy="Clinicians" 
                onappointmentcreated="rsAppointments_AppointmentCreated" 
                onappointmentupdate="rsAppointments_AppointmentUpdate" 
                onappointmentdelete="rsAppointments_AppointmentDelete">
                <TimelineView UserSelectable="False" />
                <ResourceTypes>
                    <telerik:ResourceType Name="Clinicians" KeyField="UserID" TextField="ClinicianName" ForeignKeyField="ClinicianID" />
                </ResourceTypes>
                <AppointmentTemplate>
                    <table border="0" cellpadding="3" cellspacing="0" width="100%">
                        <tr>
                            <td style="border: none;" rowspan="2"><asp:Literal ID="litContent" runat="server"></asp:Literal></td>
                        </tr>
                    </table>
                </AppointmentTemplate>
                <AppointmentContextMenuSettings EnableDefault="true" />
                <TimeSlotContextMenuSettings EnableDefault="true" />
            </telerik:RadScheduler>
function OnInsertAppointment(sender, args)
{
    var slot = args.get_targetSlot();
    var dteStart = slot.get_startTime();
    var dteEnd = slot.get_endTime();
    var res = slot.get_resource();
    var resourceID = res.get_key();
    var oManager = GetRadWindowManager();
    var oWnd = oManager.getWindowByName("rwAppointment");
    var URL = "AppointmentEdit.aspx?mode=insert&start=" + dteStart.toString("dd/MM/yyyy HH:mm:ss tt") +
              "&end=" + dteEnd.toString("dd/MM/yyyy HH:mm:ss tt") +
                        "&cID=" + resourceID +
                        "&pid=" + <%= PatientID %>;
    oWnd.setUrl(URL);
    oWnd.show();
    args.set_cancel(true);
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 02 Aug 2012, 11:23 AM
Hello Gavin,

 
You can use sender.get_selectedSlots()[0].get_startTime() if you want to get the start time of the first selected time slot.

Hope this will help you.

Greetings,
Plamen
the Telerik team
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 their blog feed now.
Tags
Scheduler
Asked by
Gavin
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or