Load Ondemand + autocomplete

2 posts, 0 answers
  1. Lizardo
    Lizardo avatar
    1 posts
    Member since:
    Mar 2011

    Posted 31 Mar 2011 Link to this post

    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.
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 06 Apr 2011 Link to this post

    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
Back to Top