this._owner.get_resources() error

10 posts, 0 answers
  1. Mike
    Mike avatar
    9 posts
    Member since:
    Nov 2007

    Posted 04 Jun 2008 Link to this post

    Hi,

    I've just updated from Q3 2007 to Q1 2008 version. I already had an integrated scheduler running fine. Now I've upgraded I get the following javascript error popping up first time I open the page:

    Line 13

    Error: 'this._owner.get_resources()' is null or not an object

    The error happens on the following line of code (within ScriptResource.axd):

    var _4=this._owner.get_resources().getResourcesByType(_3);

    After that if I click any of the calendar dates I get the following error:

    Line: 380

    Error: 'null' is null or not an object.

    This occurs on the following line (within my aspx page, obviously included the javascript from your resources): 

    var onclick = $find("ctl00_panelFadeOut").get_OnClickBehavior().get_animation();

    Please can you help to point me in the right direction, so I can resolve this issue as quickly as possible.

    Thank you.

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 Jun 2008 Link to this post

    Hello Mike,

    Could you please send us the code related to RadScheduler? You can review the release history for RadScheduler for the last two releases and check for any breaking changes in your implementation.


    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mike
    Mike avatar
    9 posts
    Member since:
    Nov 2007

    Posted 05 Jun 2008 Link to this post

    Hi Peter,

    Thanks for your reply.

    Please find the following code (aspx & aspx.cs) included below (a master page is also utilised). Please also note the asp ScriptManager is in the MasterPage. As stated before, this implementation worked fine in Q3 2007 version.

    aspx file:

    <%@ Page Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true" CodeBehind="resultscalendar.aspx.cs" Inherits="CSEServelec.Rio.ResultsReporting.Web.resultscalendar" AspCompat="true" %> 
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
    <asp:Content ID="contentMain" ContentPlaceHolderID="contentHolderMain" runat="server">  
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" EnableEmbeddedScripts="true">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadCalendar1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar2" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar3" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="RadCalendar2">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar2" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar3" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="RadCalendar3">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar2" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar3" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                    <telerik:AjaxSetting AjaxControlID="RadScheduler1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar2" /> 
                            <telerik:AjaxUpdatedControl ControlID="RadCalendar3" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30" 
                BackColor="#E0E0E0">  
    <asp:Image ID="Image1" Style="margin-top: 200px" runat="server" ImageUrl="~/App_Themes/Default/resources/Loading.gif" 
    BorderWidth="0px" AlternateText="Loading"></asp:Image> 
            </telerik:RadAjaxLoadingPanel> 
            <div id="outlookWrapper">  
                <h1><asp:Label runat="server" ID="patientsName"></asp:Label></h1>  
                <div id="outlookLinkButton">  
                    <asp:LinkButton ID="lbChangeSlots" runat="server" onclick="lbChangeSlots_Click">View by 15 min slots</asp:LinkButton> 
                </div> 
                <telerik:RadSplitter runat="server" ID="RadSplitter1" Height="557px" Width="576px" Skin="Office2007" BorderSize="0">  
                    <telerik:RadPane runat="server" ID="CalendarPane" MinWidth="175" Width="200px" CssClass="calendarPane">  
                        <telerik:RadCalendar runat="server" ID="RadCalendar1" 
                            Skin="Office2007" AutoPostBack="true" EnableMultiSelect="false" 
                            DayNameFormat="FirstTwoLetters" EnableNavigation="true" EnableMonthYearFastNavigation="false" 
                            OnSelectionChanged="RadCalendar1_SelectionChanged" ShowRowHeaders="false" 
                            OnDefaultViewChanged="RadCalendar1_DefaultViewChanged">  
                        </telerik:RadCalendar> 
                        <telerik:RadCalendar runat="server" ID="RadCalendar2" 
                            Skin="Office2007" AutoPostBack="true" EnableMultiSelect="false" ShowRowHeaders="false" 
                            DayNameFormat="FirstTwoLetters" EnableNavigation="false" EnableMonthYearFastNavigation="false" 
                            OnSelectionChanged="RadCalendar2_SelectionChanged">  
                        </telerik:RadCalendar> 
                        <telerik:RadCalendar runat="server" ID="RadCalendar3" 
                            Skin="Office2007" AutoPostBack="true" EnableMultiSelect="false" ShowRowHeaders="false" 
                            DayNameFormat="FirstTwoLetters" EnableNavigation="false" EnableMonthYearFastNavigation="false" 
                            OnSelectionChanged="RadCalendar3_SelectionChanged">  
                        </telerik:RadCalendar> 
                    </telerik:RadPane> 
                    <telerik:RadSplitBar runat="server" CollapseMode="Forward" id="RadSplitBar1" BorderWidth="0" /> 
                    <telerik:RadPane runat="server" ID="SchedulerPane" CssClass="schedulerPane" MinWidth="350" Width="564px">  
                        <telerik:RadScheduler runat="server" ID="RadScheduler1" Skin="Office2007" EnableEmbeddedSkins="True" 
                            SelectedDate="2007-03-30" DayStartTime="08:00:00" DayEndTime="18:00:00" TimeZoneOffset="00:00:00" TimeLabelRowSpan="1"    
                            DataSourceID="GetCalendarViewDataSource" DataKeyField="MessageID" DataSubjectField="TextDescription" DataStartField="ObservationDate" DataEndField="ObsEndDate" 
                            AllowDelete="False" ReadOnly="true" ShowAllDayRow="false" 
                            OverflowBehavior="Expand" SelectedView="DayView" AllowEdit="false" OnAppointmentClick="RadScheduler1_AppointmentClick" FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" GroupBy="ObservationDate" 
                            OnNavigationComplete="RadScheduler1_NavigationComplete" OnAppointmentCreated="RadScheduler1_AppointmentCreated">   
                                <TimelineView UserSelectable="false" /> 
                        </telerik:RadScheduler> 
                    </telerik:RadPane> 
                </telerik:RadSplitter> 
            </div> 
        <asp:ObjectDataSource ID="GetCalendarViewDataSource" runat="server"   
            SelectMethod="GetCalendarResult"   
            TypeName="CSEServelec.Rio.ResultsReporting.ResultsFacade.CalendarViewFacade">  
            <SelectParameters> 
                <asp:parameter DefaultValue="" Name="ClientID" Type="String" /> 
                <asp:parameter DefaultValue="" Name="fromDate" Type="DateTime" /> 
                <asp:parameter DefaultValue="" Name="toDate" Type="DateTime" /> 
            </SelectParameters> 
        </asp:ObjectDataSource> 
    </asp:Content> 


    aspx.cs

    using System;  
    using System.Collections;  
    using System.Data.OleDb;  
    using System.ComponentModel;  
    using System.Data;  
    using System.Drawing;  
    using System.Web;  
    using System.Web.SessionState;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.HtmlControls;  
    using Telerik.Web.UI;  
    using Telerik.Web.UI.Calendar;  
    using Telerik.Web.UI.Scheduler;  
    using System.Globalization;  
    using System.Text;  
     
    namespace CSEServelec.Rio.ResultsReporting.Web  
    {  
        /// <summary>  
        /// Results Calendar, to display the Order description, colour coded  
        /// dependant on results being within normal range (green), or any   
        /// results outside of normal range (red). When the result is clicked  
        /// on the user is taken to the Detailed Results page.  
        /// </summary>  
        public partial class resultscalendar : ContentPageBase  
        {  
            public resultscalendar() : base("Results Calendar") { }  
     
            /// <summary>  
            /// Gets reference to script manager for current page and register  
            /// triggers (controls which will refresh the update panel). Set up  
            /// custom attribute for scheduler so the Abnormal flag can be   
            /// referenced.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            private void Page_Load(object sender, System.EventArgs e)  
            {  
                // Set up reference for custom attribute 'abnormal flag' for later use.  
                RadScheduler1.CustomAttributeNames = new string[] { "Abnormal" };  
     
                if (!IsPostBack)  
                {  
                    // Set culture to english (GB), and set calendars Culture Info to same.  
                    CultureInfo CInfo = new CultureInfo("en-GB"true);  
                    RadCalendar1.CultureInfo = CInfo;  
                    RadCalendar2.CultureInfo = CInfo;  
                    RadCalendar3.CultureInfo = CInfo;  
                    RadScheduler1.Culture = CInfo;  
     
                    // Hide SideBanner & KeyArea from Master Page  
                    MasterPage.SideBanner.Visible = false;  
                    MasterPage.KeyArea.Visible = false;  
                    MasterPage.FooterArea.Visible = false;  
     
                    // Set Calendar1 to today's date.  
                    RadCalendar1.FocusedDate = DateTime.Parse(DateTime.Now.ToShortDateString());  
                    SyncCalendars();  
     
                    // ClientID number querystring present?  
                    if (Request.QueryString["ClientID"] != null)  
                    {  
                        // Store ClientID in local variable and set parameter for scheduler sproc  
                        string clientID = Request.QueryString["ClientID"].ToString();  
                        GetCalendarViewDataSource.SelectParameters["ClientID"].DefaultValue = clientID;  
     
                        // Call sproc to get patient's name and set patient's name  
                        ResultsFacade.CalendarViewFacade cvf = new CSEServelec.Rio.ResultsReporting.ResultsFacade.CalendarViewFacade();  
                        patientsName.Text = cvf.GetCalendarResultName(clientID);  
                    }  
                    else 
                    {  
                        patientsName.Text = "&nbsp;";  
                    }  
     
                    // Set parameters for sproc which brings back Order information  
                    GetCalendarViewDataSource.SelectParameters["fromDate"].DefaultValue = BuildDateString(DateTime.Now.ToShortDateString(), "from");  
                    GetCalendarViewDataSource.SelectParameters["toDate"].DefaultValue = BuildDateString(DateTime.Now.ToShortDateString(), "to");  
                }  
            }  
     
     
            /// <summary>  
            /// This is where the colour coding is set for an Order, based on the value of the  
            /// abnormal flag, which is coded here as an appointment attribute.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadScheduler1_AppointmentCreated(object sender, SchedulerEventArgs e)  
            {  
                if (int.Parse(e.Appointment.Attributes["Abnormal"].ToString()) == 0)  
                {  
                    e.Appointment.CssClass = "NormalStyle";  
                }  
                else 
                {  
                    e.Appointment.CssClass = "AbnormalStyle";  
                }  
            }  
            /// <summary>  
            /// Synchronising the rest of the Calendars with the to main calendar's selected date.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)  
            {  
                RadCalendar1.FocusedDate = RadScheduler1.SelectedDate;  
                SyncCalendars();  
            }  
     
     
            /// <summary>  
            /// Synchronise the rest of the calendars when calendar one date changes.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadCalendar1_DefaultViewChanged(object sender, DefaultViewChangedEventArgs e)  
            {  
                SyncCalendars();  
            }  
     
     
            /// <summary>  
            /// Calendars 2 and 3 synchronised with Calendar one values.  
            /// </summary>  
            private void SyncCalendars()  
            {  
                RadCalendar2.FocusedDate = RadCalendar1.FocusedDate.AddMonths(1);  
                RadCalendar3.FocusedDate = RadCalendar1.FocusedDate.AddMonths(2);  
            }  
     
     
            /// <summary>  
            /// When Calendar 1 selected date changed, Change date in Scheduler   
            /// and related calendars to synchronise.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadCalendar1_SelectionChanged(object sender, SelectedDatesEventArgs e)  
            {  
                if (RadCalendar1.SelectedDates.Count > 0)  
                {  
                    RadScheduler1.SelectedDate = RadCalendar1.SelectedDate;  
                    RadCalendar2.SelectedDate = RadCalendar1.SelectedDate;  
                    RadCalendar3.SelectedDate = RadCalendar1.SelectedDate;  
                }  
            }  
     
     
            /// <summary>  
            /// If Calendar 2 date changed then synchronise scheduler and other  
            /// calendars with selection.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadCalendar2_SelectionChanged(object sender, SelectedDatesEventArgs e)  
            {  
                if (RadCalendar2.SelectedDates.Count > 0)  
                {  
                    RadScheduler1.SelectedDate = RadCalendar2.SelectedDate;  
                    RadCalendar1.SelectedDate = RadCalendar2.SelectedDate;  
                    RadCalendar3.SelectedDate = RadCalendar2.SelectedDate;  
                }  
            }  
     
     
            /// <summary>  
            /// If Calendar 3 date changed then synchronise scheduler and other  
            /// calendars with selection.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadCalendar3_SelectionChanged(object sender, SelectedDatesEventArgs e)  
            {  
                if (RadCalendar3.SelectedDates.Count > 0)  
                {  
                    RadScheduler1.SelectedDate = RadCalendar3.SelectedDate;  
                    RadCalendar1.SelectedDate = RadCalendar3.SelectedDate;  
                    RadCalendar2.SelectedDate = RadCalendar3.SelectedDate;  
                }  
            }  
     
     
            /// <summary>  
            /// Enhance date string to include time for searching on date / time  
            /// range within proc.  
            /// </summary>  
            /// <param name="dtIn"></param>  
            /// <param name="type"></param>  
            /// <returns></returns>  
            private string BuildDateString(string dtIn, string type)  
            {  
                DateTime dtInternal = new DateTime();  
                DateTime dtConvertTo = new DateTime();  
                dtInternal = DateTime.Parse(dtIn);  
                if (type == "from")  
                {  
                    dtConvertTo = dtInternal.Add(new TimeSpan(00, 00, 00));  
                }  
                else 
                {  
                    dtConvertTo = dtInternal.Add(new TimeSpan(23, 59, 59));  
                }  
     
                return dtConvertTo.ToString();  
            }  
     
            /// <summary>  
            /// When link clicked on user taken to Detailed Results screen.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void RadScheduler1_AppointmentClick(object sender, SchedulerEventArgs e)  
            {  
                Response.Redirect("detailsresults.aspx?MsgID=" + e.Appointment.ID + "&ClientID=" + Request.QueryString["ClientID"].ToString());  
            }  
     
     
            /// <summary>  
            /// When clicked change view to either 15 minute or 60 minute views  
            /// and change link text appropriately.  
            /// </summary>  
            /// <param name="sender"></param>  
            /// <param name="e"></param>  
            protected void lbChangeSlots_Click(object sender, EventArgs e)  
            {  
                if (RadScheduler1.SelectedView != SchedulerViewType.MonthView)  
                {  
                    if (RadScheduler1.MinutesPerRow == 15)  
                    {  
                        RadScheduler1.MinutesPerRow = 60;  
                        RadScheduler1.TimeLabelRowSpan = 1;  
                        lbChangeSlots.Text = "View by 15 min slots";  
                    }  
                    else 
                    {  
                        RadScheduler1.MinutesPerRow = 15;  
                        RadScheduler1.TimeLabelRowSpan = 4;  
                        lbChangeSlots.Text = "View by 60 min slots";  
                    }  
     
                    // Update ajax panel  
                    //inboxUpdatePanel.Update();  
                    //this.RadAjaxLoadingPanel1.                  
                }  
                else 
                {  
                    // Put code here for message box etc...  
     
                }  
     
            }  
     
     
     
            private void GetWeekRange(System.DateTime dateIn, ref System.DateTime stDate, ref System.DateTime endDate)  
            {  
                double offset = 0;  
                switch (dateIn.DayOfWeek)  
                {  
                    case DayOfWeek.Monday:  
                        offset = 0;  
                        break;  
                    case DayOfWeek.Tuesday:  
                        offset = -1;  
                        break;  
                    case DayOfWeek.Wednesday:  
                        offset = -2;  
                        break;  
                    case DayOfWeek.Thursday:  
                        offset = -3;  
                        break;  
                    case DayOfWeek.Friday:  
                        offset = -4;  
                        break;  
                    case DayOfWeek.Saturday:  
                        offset = -5;  
                        break;  
                    case DayOfWeek.Sunday:  
                        offset = -6;  
                        break;  
                }  
                stDate = dateIn.AddDays(offset);  
                endDate = stDate.AddDays(6);  
            }  
        }  
    }  
     


    Regards
    Mike
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 09 Jun 2008 Link to this post

    Hello Mike,

    Thank you for providing the code.

    Please remove the GroupBy attribute from the RadScheduler declaration.

    The error occurs as there are no Resources defined in the Scheduler.

    Generally, it would be better if an exception is thrown in this case. We will consider implementing this in future versions of RadScheduler.

    Sincerely yours,
    Simon
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Paige Cook
    Paige Cook avatar
    57 posts
    Member since:
    Sep 2007

    Posted 18 Jun 2008 Link to this post

    I was also getting this error, but under different circumstances. My list of resources being displayed on the RadScheduler can be different based on the selections a user has made on other dropdowns on the page. Based on those selections, it is possible to not have any resources present to display.

    In order to avoid this error, I had to put a check into the GetAppointments method of my custom provider and set the TimelineView.GroupBy property dynamically based on whether there were resources to be displayed or not.

    In this the best way to prevent this error?

    Thanks.
  7. Paige Cook
    Paige Cook avatar
    57 posts
    Member since:
    Sep 2007

    Posted 18 Jun 2008 Link to this post

    Ok, so I did not fully test out the check I put into GetAppointments, because when I have that check in there, a Javascript error is thrown in a ScriptResource.axd file when I hover over an appointment. Looks like it is related to trying to determine if the delete icon should be displayed over the appointment. Here is the snippet of JavasScript code:

    var _132=this.getAppointmentDomElement(e.eventMapTarget); 
    var _133=this.getAppointmentFromDomElement(_132); 
    var _134=(_133.get_allowDelete()!=null)?_133.get_allowDelete():this.get_allowDelete(); 

    When I debug the code, the this.getAppointmentFromDomElement(_132) function is returning null.




  8. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 19 Jun 2008 Link to this post

    Hi,

    Thanks for bringing this issue. We will consider ignoring the GroupBy attribute in this scenario. Regarding the JavaScript error, I suspect that RadScheduler might need a Rebind() call after changing the GroupBy value, just to hint it to clear it's internal state. If this does not help we will need more information about your current implementation, so we can troubleshoot it.

    All the best,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Paige Cook
    Paige Cook avatar
    57 posts
    Member since:
    Sep 2007

    Posted 23 Jun 2008 Link to this post

    Thank You. Calling Rebind() after changing the GroupBy property fixed the the JavaScript error.
  10. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 17 Aug 2008 Link to this post

    Hi guys I am also getting this problem with the scheduler after upgrading to 2008.Q2.

    The error is something like this
    _169 is null
    var _16a=(_169.get_allowDelete()!=null)?...et_allowDelete():this.get_allowDelete();


  11. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 18 Aug 2008 Link to this post

    Hi,

    Can you please post the code of your page related to RadScheduler? Changing properties too late in the page life-cycle might require a call to Rebind().

    Greetings,
    Tsvetomir Tsonev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017