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

findItemByAttribute() still not working

1 Answer 77 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 2
David asked on 02 Nov 2009, 10:05 PM
Can you please post a working demo becuase even through I have the latest build (as of today), I can't call it without the Telerik managed javascript halting becuase of a null value when calling get_count().

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Nov 2009, 08:12 AM
Hi David,

I tried following workaround in order to search an item using attribute that set though ItemDataBound event of RadListBox. Have a look at the code and see whether it help.

JavaScript:
 
<script type="text/javascript"
    function SerchGetAttribute() { 
        var listBox = $find('<%= RadListBox1.ClientID %>'); 
        var item; 
        //   var item = listBox.findItemByAttribute("UsergroupID", "1"); 
        for (var i = 0; i < listBox.get_items().get_count(); i++) { 
            if (listBox.get_items().getItem(i).get_attributes().getAttribute("num") == "1") { 
                item = listBox.get_items().getItem(i); 
                break
            } 
        } 
        alert(item.get_text()); 
    } 
</script> 

-Shinu.
Tags
ListBox
Asked by
David
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or