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

Searching the RadListBox

1 Answer 265 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Hoekstra
Top achievements
Rank 1
Hoekstra asked on 05 Aug 2011, 04:45 PM
Hello!

I want to build a RadListBox with loadOnDemand functionality. A requirement is that the scrollbar should be on the correct position, so in a box of 20k items, when scrolling to number 10k the scrollbar should be halfway. The dataset is available in the code-behind. So far so good.

The thing is, I need to be able to do a search its items. The search should be fired to the server, where I can determine the current position or page of the listbox by doing a search on my dataset.
For example in a separate textbox (or preferrably in some built in popup in the listbox) I want to do a search with text '200'. What should happen is the following; the listbox should load the first page with the first item beginning with '200'. The scrollbar of the listbox should still represent the current position of the total of records.

Can you give me any directions how to implement this?

Greetings,

Hoekstra

1 Answer, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 10 Aug 2011, 12:53 PM
Hello Hoekstra,

Please use the following method getItemAsync to get an item from listbox when the load on demand is used. Here is a sample code how to select and scroll to a certain item:
var listBox = $find("radListBox1");
        var item = listBox.getItemAsync(1000, function(item) { item.scrollIntoView (); item.set_selected(true);});

You can use a web service to get the row number of the searched text.

Greetings,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
ListBox
Asked by
Hoekstra
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Share this question
or