Radlistbox get and set selected items

Thread is closed for posting
2 posts, 0 answers
  1. Mansi
    Mansi avatar
    63 posts
    Member since:
    Feb 2009

    Posted 28 Jan 2010 Link to this post


    I need to select/deselect items from one listbox to another.
    For that I am using two radlistboxes, both are having same items. Both listbox's selectionmode="Multiple".

    When user selects items in first list, I need to select them in second listbox through Javascript.
    For that, I tried some code, but it works for single item only.

               var ctl1= $find('<%= lstTestcategory2.Clientid %>'); 
                  var ctl= $find('<%= lstTestcategory.Clientid %>'); 
        for(var i = 0; i<= ctl.get_items().get_count()-1; i++)   
              var item1 = ctl.get_items().getItem(i);    
                 check = 1;  
          for(var i = 0; i<= ctl1.get_items().get_count()-1; i++)   
          //     alert('in');  
                    var item = ctl1.get_items().getItem(i);       
                    if(item.get_text() == e.get_item().get_text())  
               //    alert('in1');   
                        check = 1;  

    At present I am using it on "OnClientSelectedIndexChanging" event.

    What should I do to work it for multiple items too?
  2. Yana
    Yana avatar
    5039 posts

    Posted 01 Feb 2010 Link to this post

    Hello Mansi,

    You are right that OnClientSelectedIndexChanged event is fired for every selected item, so you should select the items in the other listbox separately.

    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.
Back to Top