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

[Solved] OnLoadDemand and js exception

1 Answer 92 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 22 Feb 2010, 10:00 AM
Hello,
I'm trying to use your Ajax product with WCF Webservice, I've crated a webmethod :

    [OperationContract] 
        public RadComboBoxData GetGruppi(RadComboBoxContext context) 
        { 
            RadComboBoxData result = new RadComboBoxData(); 
 
            DataSet ds = dataAccess.GetListaGruppi(); 
 
            if (ds != null && ds.Tables[0].Rows.Count > 0) 
            { 
                List<RadComboBoxItemData> lst = new List<RadComboBoxItemData>(); 
 
                foreach (DataRow dr in ds.Tables[0].Rows) 
                { 
                    RadComboBoxItemData item = new RadComboBoxItemData(); 
 
                    item.Text = GetCheckedString(dr[2]); 
                   // item.Value = string.Format("{0}-{1}", Convert.ToInt32(dr[0]), Convert.ToInt32(dr[1])); 
                    item.Value = GetCheckedString(dr[0]); 
                    lst.Add(item); 
 
                } 
 
                
                result.Items = lst.ToArray(); 
            } 
 
 
            return result; 
        } 

and attached from ajax the WebServiceSetting :

 <WebServiceSettings Method="GetGruppi" Path="../WS/IFManagement.svc" /> 


but each time I try to use it I got this error :

Microsoft JScript runtime error: 'length' is null or not an object

The WS method is executed (I see the data in the result (via Vs2008) but when it should bind to the combobox got that exception...
any suggestion??
Thanks in advance
Paolo

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 23 Feb 2010, 06:07 PM
Hi Paolo,

Can you please verify whether result.Items is actually assigned in the end of the Web Method?

Please also compare your code to that in this live demo.

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.
Tags
ComboBox
Asked by
Michele
Top achievements
Rank 2
Answers by
Simon
Telerik team
Share this question
or