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

Client-side methods findItemByText and findItemByValue

2 Answers 425 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
mlandauer
Top achievements
Rank 1
mlandauer asked on 26 Aug 2009, 09:33 PM
These methods are in the documentation, but when I try to use them, I get an error that they are undefined.  Breaking within my javascript reveals that they in fact do NOT exist.  How does one determine whether or not an item is already in the RadListBox on the client-side?

My code is below.  rlbOtherCSRs is a RadListBox and rcbOtherCSRs is a RadComboBox.  I'm trying to copy the item from the combo box to the list box, but only if the list box doesn't already have it.

                function AddOtherCSRClick() {  
                    var rcbOther = $find("<%= rcbOtherCSRs.ClientID %>");  
                    var rlbOther = $find("<%= rlbOtherCSRs.ClientID %>");  
 
                    if (rcbOther.get_selectedIndex() > 0) {  
                        var selected = rcbOther.get_selectedItem();  
                        var existingitem = rlbOther.findItemByValue(selected.get_value());  
                        if (!existingitem) {  
                            var newitem = new Telerik.Web.UI.RadListBoxItem();  
                            newitem.set_value(selected.get_value());  
                            newitem.set_text(selected.get_text());  
                            rlbOther.trackChanges();  
                            rlbOther.get_items().add(newitem);  
                            newitem.select();  
                            rlbOther.commitChanges();  
                        }  
                    }  
                }  
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 27 Aug 2009, 01:18 PM
Hello,

Please download our latest release Q2 2009 SP1 where these methods are available.

Regards,
Yana
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
mlandauer
Top achievements
Rank 1
answered on 27 Aug 2009, 06:53 PM
Thank you... that fixed it.  I updated to Q2 2009 one day too early for SP1.  ;)
Tags
ListBox
Asked by
mlandauer
Top achievements
Rank 1
Answers by
Yana
Telerik team
mlandauer
Top achievements
Rank 1
Share this question
or