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

Bulk InsertItems into Listbox

1 Answer 95 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 18 Mar 2011, 03:57 PM
I am trying to do a bulk insert items from one radlistbox to another radlistbox.  In my javascript code, I am getting all the checkeditems from the first listbox (which returns an array) and trying to insert them into the destination (provision) listbox.


 function SetProvisions(RadListBoxArray) {

         var RadListBoxCount = RadListBoxArray.length;
         var i = 0;
         var ProvisionListBox = $find("<%= uxProvisions.ClientID %>");

         for (i = 0; i < RadListBoxCount; i++) {
             var RadListBox = RadListBoxArray[i];
             var RadListBoxCheckedItems = RadListBox.get_checkedItems();
             ProvisionListBox.insertItems(RadListBoxCheckedItems);       <<<<Getting error here
         }

         ProvisionListBox.commitChanges();
     }

Getting error stating that "Array of RadListBox items or Telerik.Web.UI.RadListBoxItem collection should be passed."

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Mar 2011, 01:55 PM
Hello dan,

From the error I assume that "RadListBoxCheckedItems"  is not a collection of RadListItems. Could you check whether it retrieves RadListBoxItems collection?

The "insertItems" method worked perfectly in my end when I passed RadListBoxItems array as parameter.
 

Thanks,
Princy.
Tags
ListBox
Asked by
Dan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or