This is a migrated thread and some comments may be shown as answers.
Client-side error in isRoomOccupied
5 Answers 71 Views
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 12 May 2009, 07:20 PM
I am following the resource example (with changes) and I am getting an error (Microsoft JScript runtime error: Object doesn't support this property or method) when I am in the following function - it is bombing on slot.get_resource();

 

function isRoomOccupied(scheduler, start, end, slot, appointment)

{

//get the "Room" resource associated with the time slot

var currentRoom = slot.get_resource();

//get all appointments for this "room" in the specified period

var appointmentsForThisRoom = getAppointmentsInRangeByResource(scheduler, start, end, currentRoom, appointment);

//if the list of appointments is not empty there are other appointments in this slot

return appointmentsForThisRoom.get_count() > 0;

}

I am not sure what I am doing wrong. Thanks.

function isRoomOccupied(scheduler, start, end, slot, appointment)

 

{

 

//get the "Room" resource associated with the time slot

 

 

 

 

 

 

var currentRoom = slot.get_resource();

 

 

//get all appointments for this "room" in the specified period

 

 

 

 

 

 

var appointmentsForThisRoom = getAppointmentsInRangeByResource(scheduler, start, end, currentRoom, appointment);

 

 

//if the list of appointments is not empty there are other appointments in this slot

 

 

 

 

 

 

return appointmentsForThisRoom.get_count() > 0;

 

}

 

function warnIfOccupied(start, end, sender, args)

 

{

 

var slot = args.get_targetSlot();

 

 

var appointment = args.get_appointment();

 

 

 

if (isRoomOccupied(sender, start, end, slot, appointment))

 

{

alert(

"This room is not available in this time period.");

 

args.set_cancel(

true);

 

}

 

appointment.get_element().style.border =

"";

 

}

 

function onAppointmentResizeEnd(sender, args)

 

{

 

var start = args.get_appointment().get_start();

 

 

var end = args.get_targetSlot().get_endTime();

 

 

warnIfOccupied(start, end, sender, args);

}

 

function onAppointmentMoveEnd(sender, args)

 

{

 

var start = args.get_targetSlot().get_startTime();

 

 

var end = new Date(start.getTime() + args.get_appointment().get_duration());

 

 

warnIfOccupied(start, end, sender, args);

}

 

function onAppointmentInserting(sender, args)

 

{

 

var slot = args.get_targetSlot();

 

 

var start = slot.get_startTime();

 

 

var end = slot.get_endTime();

 

 

 

if (isRoomOccupied(sender, start, end, slot))

 

{

alert(

"This room is not available in this time period.");

 

args.set_cancel(

true);

 

}

}

 

 

 

<

 

telerik:RadScheduler runat="server" ID="RadScheduler1" OnClientAppointmentEditing="AppointmentEditing"

 

 

 

 

 

 

OnClientAppointmentInserting="AppointmentInserting" EnableCustomAttributeEditing="true"

 

 

 

 

 

 

SelectedDate="2009-07-26" DataSourceID="EventsDataSource" DataKeyField="MeetingID"

 

 

 

 

 

 

DataSubjectField="Description" DataStartField="Start" DataEndField="End" SelectedView="WeekView"

 

 

 

 

 

 

FirstDayOfWeek="Sunday" LastDayOfWeek="Saturday" Skin="Vista" ShowResourceHeaders="false"

 

 

 

 

 

 

CustomAttributeNames="Description,HostedBy,Room" Height="100%" Localization-ConfirmDeleteText="Are you sure you want to delete this meeting?"

 

 

 

 

 

 

TimelineView-UserSelectable="false" OnClientAppointmentMoveEnd="onAppointmentMoveEnd"

 

 

 

 

 

 

OnClientAppointmentResizeEnd="onAppointmentResizeEnd">

 

 

 

 

 

 

<ResourceTypes>

 

 

 

 

 

 

<telerik:ResourceType KeyField="Room" Name="Room" TextField="Room" ForeignKeyField="Room"

 

 

 

 

 

 

DataSourceID="RoomsDataSource" />

 

 

 

 

 

 

</ResourceTypes>

 

 

 

 

 

 

<AppointmentTemplate>

 

 

 

 

 

 

<div style="color: Maroon;">

 

 

 

 

 

<%

#Eval("Description")%></div>

 

 

 

 

 

<%

-- <br />--%>

 

 

<div style="color: Teal;">

 

 

 

 

 

 

</font>Host:&nbsp;<%#Eval("HostedBy")%></div>

 

 

 

 

 

<%

-- <br />--%>

 

 

<div style="color: Fuchsia;">

 

 

 

 

 

Room:

&nbsp;<%#Eval("Room")%></div>

 

 

 

 

 

 

</AppointmentTemplate>

 

 

 

 

 

 

</telerik:RadScheduler>

 

 

 

 

 

 

<asp:Button ID="btnGo" runat="server" Text="Go" Visible="false" />

 

 

 

 

 

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>

 

 

 

 

 

 

<asp:SqlDataSource ID="EventsDataSource" runat="server" ProviderName="System.Data.SqlClient"

 

 

 

 

 

 

ConnectionString="<%$ ConnectionStrings:MCHPEVENTS %>" SelectCommand="SELECT [MeetingID], [Description], [Start], [End], [Room], [HostedBy], [Food], [Beverages], [Projector], [Easel], [Flipchart], [Microphone], [HotelAVSupplies], [Comments] FROM [Meetings]"

 

 

 

 

 

 

InsertCommand="INSERT INTO [Meetings] ([Description], [Start], [End], [Room]) VALUES (@Description, @Start, @End, @Room)"

 

 

 

 

 

 

UpdateCommand="UPDATE [Meetings] SET [Description] = @Description, [Start] = @Start, [End] = @End, [Room] = @Room WHERE (MeetingID = @MeetingID)"

 

 

 

 

 

 

DeleteCommand="DELETE FROM [Meetings] WHERE [MeetingID] = @MeetingID">

 

 

 

 

 

 

<DeleteParameters>

 

 

 

 

 

 

<asp:Parameter Name="MeetingID" Type="Int32" />

 

 

 

 

 

 

</DeleteParameters>

 

 

 

 

 

 

<UpdateParameters>

 

 

 

 

 

 

<asp:Parameter Name="MeetingID" Type="Int32" />

 

 

 

 

 

 

<asp:Parameter Name="Description" Type="String" />

 

 

 

 

 

 

<asp:Parameter Name="Start" Type="DateTime" />

 

 

 

 

 

 

<asp:Parameter Name="End" Type="DateTime" />

 

 

 

 

 

 

<asp:Parameter Name="Room" Type="String" />

 

 

 

 

 

 

</UpdateParameters>

 

 

 

 

 

 

<InsertParameters>

 

 

 

 

 

 

<asp:Parameter Name="Description" Type="String" />

 

 

 

 

 

 

<asp:Parameter Name="Start" Type="DateTime" />

 

 

 

 

 

 

<asp:Parameter Name="End" Type="DateTime" />

 

 

 

 

 

 

<asp:Parameter Name="Room" Type="String" DefaultValue="TBD" />

 

 

 

 

 

 

</InsertParameters>

 

 

 

 

 

 

</asp:SqlDataSource>

 

 

 

 

 

 

<asp:SqlDataSource ID="RoomsDataSource" runat="server" ProviderName="System.Data.SqlClient"

 

 

 

 

 

 

ConnectionString="<%$ ConnectionStrings:MCHPEVENTS %>" SelectCommand="SELECT DISTINCT([Room]) FROM [Meetings]">

 

 

 

 

 

 

</asp:SqlDataSource>

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 May 2009, 12:56 PM
Hello Darren,

Please, make sure you are using the current official version (2009.1.402). If the problem still persists, please open a support ticket and send us a simple working demo project which we can test locally.


All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nick
Top achievements
Rank 1
answered on 09 Jun 2009, 02:24 AM
I am receiving the same error. I'm on the latest version 2009.1.527.35. As soon as I go to drag an appointment to another slot, I get the error and it keeps popping up. I'm using the functions from the ResourceAvailabilty  example.
0
Peter
Telerik team
answered on 10 Jun 2009, 09:26 AM
Hi Nick,

Can you isolate the problem in a simple workind demo and send it to us for testing via a support ticket?

Greetings,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Lee Malo
Top achievements
Rank 1
answered on 22 Jun 2011, 05:47 PM
did you find the problem here? I'm getting the same error as the op
0
Veronica
Telerik team
answered on 30 Jun 2011, 08:10 AM
Hello Lee Malo,

Could you please open new support thread and send us a sample project that reproduces the issue so we can inpect it and help you as Peter requested?

Thank you!

Kind regards,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Asked by
Darren
Top achievements
Rank 1
Answers by
Peter
Telerik team
Nick
Top achievements
Rank 1
Lee Malo
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or