JavaScript error on startup

8 posts, 1 answers
  1. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 15 Jul 2011 Link to this post

    I am running version 2011.2.712.40 which I think is the latest version. When my project loads the first time I get the following error:

    Microsoft JScript runtime error: Unable to get value of the property 'tHead': object is null or undefined

    The highlighted code is in the RadTreeList prototype.
    Telerik.Web.UI.RadTreeList.prototype=
    ...
    _getTableHeaderRow:function(b){var c=null;
    if(b.tHead){for(var a=0;
    a<b.tHead.rows.length;
    a++){if(b.tHead.rows[a]!=null){if(b.tHead.rows[a].cells[0]!=null){if(b.tHead.rows[a].cells[0].tagName!=null){if(b.tHead.rows[a].cells[0].tagName.toLowerCase()=="th"){c=b.tHead.rows[a];
    break;
    }}}}}}return c;
    },
    ...

    The declaration of the RadTreeList looks like this:

                    <telerik:RadTreeList ID="myData" runat="server" DataSourceID="sqlData" DataKeyNames="ID" ParentDataKeyNames="ParentID" AutoGenerateColumns="false" OnDataBound="myData_DataBound">
                        <Columns>
    ...
                        </Columns>
     
                        <NoRecordsTemplate>
                            <span>There is no data selected!</span>
                        </NoRecordsTemplate>
                    </telerik:RadTreeList>


    Is there something I am missing that would cause this error as it does not happen on version 2011.1.519.40?
  2. Martin
    Admin
    Martin avatar
    811 posts

    Posted 20 Jul 2011 Link to this post

    Hello John Thompson,

    I have tried to reproduce the described issue locally, but without success. Attached is a small sample that I used for testing. Please give it a try and let me know whether I miss something.

    Regards,
    Martin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 25 Jul 2011 Link to this post

    I agree that your project works!  And my attempts at simplifying my project to recreate the issue is, thus far, fruitless. However, that does not help my issue.  Tracing back through the client side JavaScript, the issue occurs in the initialize method of the RadTreeList where the tableElement is obtained.

    tableElement=this.get_element().getElementsByTagName("table")[0];

    At the time this line is executed in my project, the resulting array is empty with a length of zero.  The "this.get_element()" call returns an INPUT element with the innerHTML property as follows:

    <input id="ctl00_body_myCase_ClientState" name="ctl00_body_myCase_ClientState" type="hidden" autocomplete="off">

    Could the issue be time dependent since there are no TABLE descendents of the RadTreeList yet?  I have noted that, through tracing the JavaScript the TABLE element will be created a few milliseconds later.  EDIT: Also, could it be when there is no data there is no TABLE child element?  I would truly like to find the issue here!
  5. Justus Herrmann
    Justus Herrmann avatar
    2 posts
    Member since:
    Nov 2009

    Posted 26 Jul 2011 Link to this post

    Hi,

    I get the same error as soon as I try OnNeedDataSource or manually binding to an ArrayList.
    For me it only works if DataSourceID has been set like in the sample.

    Cheers
    Justus
  6. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 26 Jul 2011 Link to this post

    I am using a SqlDataSource and a Session based SelectParameter which is NULL on start up.  I'll do some testing to see if that is an issue.
  7. Martin
    Admin
    Martin avatar
    811 posts

    Posted 26 Jul 2011 Link to this post

    Hello John,

    I was able to reproduce the issue when after I used a select parameter with an empty default value. I will pass this report to our developers for further investigation. Once I have any feedback I will get back to you with more details.

    Regards,
    Martin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  8. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 26 Jul 2011 Link to this post

    That's great!  In the mean time, I have added default values that can never appear in the database and the issue is not manifesting.
  9. Answer
    Martin
    Admin
    Martin avatar
    811 posts

    Posted 27 Jul 2011 Link to this post

    Hello John Thompson,

    I would like to inform you that our developers managed to fix the issue and the change will be included in the next latest internal build of RadControls. I have also updated your Telerik points for the involvement.

    All the best,
    Martin
    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
UI for ASP.NET Ajax is Ready for VS 2017