Client-side error in isRoomOccupied

6 posts, 0 answers
  1. Darren
    Darren avatar
    72 posts
    Member since:
    Oct 2006

    Posted 12 May 2009 Link to this post

    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>

     

     

     

     

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 May 2009 Link to this post

    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.
  3. Nick
    Nick avatar
    11 posts
    Member since:
    Jan 2009

    Posted 08 Jun 2009 Link to this post

    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.
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 10 Jun 2009 Link to this post

    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.
  5. Lee Malo
    Lee Malo avatar
    32 posts
    Member since:
    Apr 2008

    Posted 22 Jun 2011 Link to this post

    did you find the problem here? I'm getting the same error as the op
  6. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 30 Jun 2011 Link to this post

    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.

Back to Top