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

JavaScript error on startup

7 Answers 105 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
John Thompson
Top achievements
Rank 2
John Thompson asked on 15 Jul 2011, 03:10 PM
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?

7 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 20 Jul 2011, 12:09 PM
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!

0
John Thompson
Top achievements
Rank 2
answered on 25 Jul 2011, 10:51 PM
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!
0
Justus Herrmann
Top achievements
Rank 2
answered on 26 Jul 2011, 01:41 PM
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
0
John Thompson
Top achievements
Rank 2
answered on 26 Jul 2011, 03:47 PM
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.
0
Martin
Telerik team
answered on 26 Jul 2011, 04:00 PM
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!

0
John Thompson
Top achievements
Rank 2
answered on 26 Jul 2011, 05:38 PM
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.
0
Accepted
Martin
Telerik team
answered on 27 Jul 2011, 01:00 PM
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.

Tags
TreeList
Asked by
John Thompson
Top achievements
Rank 2
Answers by
Martin
Telerik team
John Thompson
Top achievements
Rank 2
Justus Herrmann
Top achievements
Rank 2
Share this question
or