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

How to use RadListBox with ajax listsearchextender

3 Answers 102 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 17 Jul 2012, 07:29 AM
Hi all,
I am trying to use radlistbox with ajax listsearch extender but it is giving error like
"

Extender control 'ajaxListSearchExtender' cannot extend 'RadListBoxSource'. Extender controls of type 'AjaxControlToolkit.ListSearchExtender' cannot extend controls of type 'Telerik.Web.UI.RadListBox'.

"
how can i do this...

i have 500 items in listbox i want to do listsearch...
help me...

3 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 27 Jul 2012, 05:18 PM
I am looking into this same thing.  I have tried all the different javascript stuff out there and none of it functions like I need it too.  Most will only select based on the first letter you type.

I would like to see if telerik has an extender class for this or if I have to build one using open source control toolkit.

Joe
0
Dimitar Terziev
Telerik team
answered on 01 Aug 2012, 02:17 PM
Hello Joe,

Currently we do not provide such extender class which could be used, the only build-in functionality for filtering of the RadListBox is demonstrated in the following demo here.

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Joseph
Top achievements
Rank 1
answered on 21 Aug 2012, 05:05 PM

I had the same issue, this is how I resolved it, it will scroll as you type.  Most people use the keypress value but that only gets the most recent keypress, use the getElemtnbyid for your search value and the following javascript.

  function filter_lstAvailableRIC(sender, e) {
        var list = $find("<%= lstAvailableRIC.ClientID %>");
        var searchText = document.getElementById('<%=txtSearchRic.ClientID%>').value;
        var items = list.get_items();
        for (var i = 0; i < items.get_count(); i++) {
            var item = items.getItem(i);
            var SelectPrgm;
            if (item.get_text().toLowerCase().startsWith(searchText.toLowerCase())) {
                item.select();

                item.ensureVisible();
                item.scrollIntoView;
                //SelectPrgm = $find("RadTextBox1")
                SelectPrgm = $find("<%= txtSearchRic.ClientID %>");
                SelectPrgm.set_value();
                SelectPrgm.set_value(searchText);

                break;
            }
            else {
                item.unselect();
            }
        }
    }

Tags
ListBox
Asked by
Venkat
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or