I have the following bit of code that I have taken from Telerik examples... I have a Rad Window with two RadListBoxes. When the user clicks a button the function returnToParent() is called. This should
a) find the RadListBox2 (which it does)
b) find out how many items are in the RadListBox (this fails with the error Object does not support this property or method)
c) if there are no items show error message (yet to check)
d) iterate through each item and create a string containing each item separated with a semicolon and space (yet to check)
e) remove the last semicolon and space (yet to check)
f) close window id string has a value else give error message (yet to check)
This is my code.... why do I get the error Object does not support this property or method​ at line var x = listBox.get_items().get_count();
<script type="text/javascript"> function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow; } function returnToParent() { //create the argument that will be returned to the parent page var oArg = new Object(); //get the ServiceNames name var listBox = document.getElementById("RadListBox2"); listBox = $telerik.toListBox(listBox);
//error at the next line...
var x = listBox.get_items().get_count(); if (x < 1) { alert("The listBox is empty."); oArg.Services = ""; } else { for (i = 0; i < x; i++) { oArg.Services += listBox.get_items().get_item(i).value() + "; " } //remove the last semicolon and space oArg.Services = oArg.Services.substring(0, oArg.Services.length - 2); } //get a reference to the current RadWindow var oWnd = GetRadWindow(); //Close the RadWindow and send the argument to the parent page if (oArg.Service) { oWnd.close(oArg); } else { alert("At least one service must be assigned. If Unknown enter TBC."); } } </script>Any help appreciated