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

Load Ondemand + autocomplete

1 Answer 150 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Lizardo
Top achievements
Rank 1
Lizardo asked on 31 Mar 2011, 10:28 PM
Hi,

I have a page that uses a user control that contains a telerik:RadGrid which uses another control for edit that contains a radcombo. I enabled load on demand and everything works fine withone exception. The when typing it doesn't call load on demand only when I scoll down and does not filter based on what the user enteres. Here is the code that is behind the Edit Control.

protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

{

IEnumerable<Client> clients = BizLayer.Instance().ClientsGetAllUnfiltered();

var AllClients = from c in clients where c.ClientName.Contains(e.Text) select c;

int itemOffset = e.NumberOfItems;

int endOffset = Math.Min(itemOffset + ItemsPerRequest, AllClients.Count());

e.EndOfItems = endOffset == AllClients.Count();

var filter = AllClients.Skip(itemOffset).Take(ItemsPerRequest);

foreach (Domain.Client c in filter)

{

RadComboBox1.Items.Add(new RadComboBoxItem(c.ClientName.ToString(), c.ClientId.ToString()));

}

e.Message = GetStatusMessage(endOffset, AllClients.Count());

}

Thank you.

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 06 Apr 2011, 11:00 AM
Hello Lizardo,

In general when you have Load-On-Demand and Autocomplete, the RadComboBox is loading data which corresponds to the text written in the input. If you have set Filter="StartsWith" then all items which starts with the given text will be loaded.

Since you have define that you want certain amount of items to be returned per request you should use the scroller to initiate request for more items.

What you experience is the default behavior when Load-On-Demand and AutoComplete are used.

Greetings,
Dimitar Terziev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
Lizardo
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or