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

RadComboBox ScriptResource.axd error

9 Answers 149 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chris Salas
Top achievements
Rank 1
Chris Salas asked on 04 Jan 2010, 04:44 PM
I am having an issue with loading a RadComboBox from a Web Service.  I have attempted to use the code from the demo with no luck. When I click on the RadComboBox I get an error in the ScriptResource.axd and do not know how to correct this.  Any insight would be great.

The error I get is this: 

Line: 1218
Error: 'length' is null or not an object

Thank you in advance,

Chris Salas

 

9 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 05 Jan 2010, 03:04 PM
Hello Chris Salas,

Please make sure that you are returning an empty array when there are no Items and not null.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Chris Salas
Top achievements
Rank 1
answered on 05 Jan 2010, 03:20 PM
<telerik:RadComboBox ID="radCBABA" runat="server" Width="125px" EnableLoadOnDemand="true" DropDownWidth="300px" ShowMoreResultsBox="false" ShowToggleImage="false" EnableVirtualScrolling="false" 
WebServiceSettings-Method="GetCompletionListTelerik" WebServiceSettings-Path="AutoCompleteABA.asmx"></telerik:RadComboBox> 

 <WebMethod()> _  

    Public Function GetCompletionListTelerik(ByVal context As Telerik.Web.UI.RadComboBoxContext) As Telerik.Web.UI.RadComboBoxData  
        Dim comboData As New Telerik.Web.UI.RadComboBoxData()  
        If context.Text.Length >= 3 Then 
            Dim tmpDS As DataSet = GetData(context.Text, 30)  
            Dim data As Data.DataTable = tmpDS.Tables(0)  
 
            Dim itemOffset As Integer = context.NumberOfItems  
            Dim endOffset As Integer = Math.Min(itemOffset + 30, data.Rows.Count)  
            comboData.EndOfItems = endOffset = data.Rows.Count  
 
            Dim result As New Generic.List(Of Telerik.Web.UI.RadComboBoxItemData)(endOffset - itemOffset)  
 
            For i As Integer = itemOffset To endOffset - 1  
                Dim itemData As New Telerik.Web.UI.RadComboBoxItemData()  
                itemData.Text = data.Rows(i)("ABANumber").ToString() & " - " & data.Rows(i)("BankName").ToString()  
                itemData.Value = data.Rows(i)("ABANumber").ToString()  
                result.Add(itemData)  
            Next 
 
            comboData.Message = GetStatusMessage(endOffset, data.Rows.Count)  
 
            comboData.Items = result.ToArray()  
            Return comboData  
        Else 
            Return comboData  
        End If 
    End Function 

 

Here is the code that I am using within the Web Service.  I copied and modified the code from the example on the Demo site.  When debugging the site it never hits the method.

 

0
Accepted
Simon
Telerik team
answered on 05 Jan 2010, 04:01 PM
Hi Chris Salas,

Do you receive an error message saying that the Web Method GetCompletionListTelerik has failed?

If not, then the Web Method should execute, still I noticed that if the text in the input is less than three characters you return an empty RadComboBoxData object. The Items array of this object is null by default, so this most likely causes the "'length' is null or not an object" exception. 

If this is the case, please assign to the Items property a new empty array before returning it in the else clause.

Regards,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Chris Salas
Top achievements
Rank 1
answered on 05 Jan 2010, 05:18 PM
Simon,

I added the code you suggested and still get the same error.  Could this be happening because I have the RadComboBox within an AjaxControlToolKit Tab Panel?

Thanks,

Chris

Simon,

The issue has been resolved.  I was setting the WebServiceSetting-Path incorrectly.  Thank you for your help.

Chris Salas
0
xrimson
Top achievements
Rank 1
answered on 22 Feb 2010, 12:53 AM
I'm getting the same error.  Any update on this?
0
Simon
Telerik team
answered on 23 Feb 2010, 01:00 PM
Hi Jason Herron,

Please make sure that the Web Service Path and Web Method Name in the RadComboBox declaration are correct and also the Web Service is returning an empty array when there are no Items and not null.

All the best,
Simon
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bogdan Cucosel
Top achievements
Rank 1
answered on 25 Feb 2010, 06:02 PM
Hello,
 
I'm also getting the errror Error: 'length' is null or not an object when calling a WCF service from the RadComboBox.

The result I get is :

{"d":{"__type":"RadComboBoxData:#Telerik.Web.UI","_context":[],"_endOfItems":true,"_items":[{"__type":"RadComboBoxItemData:#Telerik.Web.UI","_attributes":[{"Key":"Id","Value":"444c0bfd-3cb4-4b79-894a-9d0600d0b235"},{"Key":"Name","Value":"Frank Herbert"},{"Key":"BirthDate","Value":"\/Date(-1553655600000+0300)\/"},{"Key":"BirthCity","Value":"Tacoma, WA"}],"_enabled":true,"_text":"Frank Herbert","_value":"444c0bfd-3cb4-4b79-894a-9d0600d0b235"},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","_attributes":[{"Key":"Id","Value":"f6f0a80e-0484-42d9-be48-9d0d00fe1360"},{"Key":"Name","Value":"Jerome K Jerome"},{"Key":"BirthDate","Value":"\/Date(-3492385200000+0300)\/"},{"Key":"BirthCity","Value":"Walsall, Staffordshire"}],"_enabled":true,"_text":"Jerome K Jerome","_value":"f6f0a80e-0484-42d9-be48-9d0d00fe1360"},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","_attributes":[{"Key":"Id","Value":"3feda487-e146-4597-941e-9d280096fa49"},{"Key":"Name","Value":"Jules Verne"},{"Key":"BirthDate","Value":"\/Date(-2139876000000+0200)\/"},{"Key":"BirthCity","Value":"Paris"}],"_enabled":true,"_text":"Jules Verne","_value":"3feda487-e146-4597-941e-9d280096fa49"},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","_attributes":[{"Key":"Id","Value":"fb21fc6b-8688-4b7f-89c5-9d280098220f"},{"Key":"Name","Value":"Alexandre Dumas"},{"Key":"BirthDate","Value":"\/Date(-2153098800000+0300)\/"},{"Key":"BirthCity","Value":"Paris"}],"_enabled":true,"_text":"Alexandre Dumas","_value":"fb21fc6b-8688-4b7f-89c5-9d280098220f"},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","_attributes":[{"Key":"Id","Value":"76b83732-122f-43b8-bcd0-9d28009849dc"},{"Key":"Name","Value":"Orson Scott Card"},{"Key":"BirthDate","Value":"\/Date(-1516500000000+0200)\/"},{"Key":"BirthCity","Value":"New York"}],"_enabled":true,"_text":"Orson Scott Card","_value":"76b83732-122f-43b8-bcd0-9d28009849dc"}],"_message":"Items <b>1<\/b>-<b>5<\/b> out of <b>5<\/b>","_numberOfItems":0,"_text":"","_value":""}}


So , the wcf service is called, it returns data.
Don't actually know why the message above is a bit different from the one from the demo wich has upper case letters instead of underscores :

{"d":{"__type":"RadComboBoxData:#Telerik.Web.UI","Context":[],"EndOfItems":false,"Items":[{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Alejandra Camino","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Alexander Feuer","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Ana Trujillo","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Anabela Domingues","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"André Fonseca","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Ann Devon","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Annette Roulet","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Antonio Moreno","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Aria Cruz","Value":""},{"__type":"RadComboBoxItemData:#Telerik.Web.UI","Attributes":[],"Enabled":true,"Text":"Art Braunschweiger","Value":""}],"Message":"Items <b>1<\/b>-<b>10<\/b> out of <b>91<\/b>","NumberOfItems":0,"Text":"","Value":""}}



Could this be a problem ? If it is why ? My WCF service is configured as in the RadComboBox LoadOnDemand WCF sample.

Thank you

0
Simon
Telerik team
answered on 01 Mar 2010, 12:30 PM
Hello Bogdan Cucosel,

This can happen if you are using the 2.0 Telerik.Web.UI dll in a 3.5 project. In this case, the serialization is different, as you have noticed, and data properties come with names starting with _lowercaseLetter.

Please switch to Telerik.Web.UI 3.5 to avoid this issue.

Kind regards,
Simon
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bogdan Cucosel
Top achievements
Rank 1
answered on 01 Mar 2010, 03:59 PM
Thank you very much
Tags
ComboBox
Asked by
Chris Salas
Top achievements
Rank 1
Answers by
Simon
Telerik team
Chris Salas
Top achievements
Rank 1
xrimson
Top achievements
Rank 1
Bogdan Cucosel
Top achievements
Rank 1
Share this question
or