RadComboBox for ASP.NET AJAX

RadControls for ASP.NET AJAX

Using the ShowMoreResultsBox with the ItemsRequested event

Both the ShowMoreResultsBox and Virtual Scrolling mechanisms fire the ItemsRequested event upon each click on the ShowMoreResultsBox or scrolling down using the vertical scrollbar of the drop-down area.

The ShowMoreResultsBox and the EnableVirtualScrolling properties let you load portions of the combobox items in each ItemsRequested event handler to achieve a faster loading speed.

Note

You can use these approaches separately from one another.

For example, you could add 10 items per a request:

ComboBox ShowMoreResults Box

After clicking on the ShowMoreResultsBox or scrolling down via the vertical scrollbar of the dropdown, the next 10 items will be added to the Items list.

ComboBox ShowMoreResults Box After

To enable load-on-demand with a show more results box and/or virtual scrolling:

  1. Set the ShowMoreResultsBox property to True.

  2. Set the EnableVirtualScrolling property to True if you need to also enable the virtual scrolling mechanism.

  3. Set the EnableLoadOnDemand property to True.

  4. Add an ItemsRequested event handler that supplies the next batch of items. On the EventArgs of the event handler, the NumberOfItems property indicates the number of items that have already been loaded and the Message property lets you specify the message that appears in the ShowMoreResults box.

Using the ShowMoreResultsBox with a WebService

In addition you can populate the combobox items via a WebService and still use the ShowMoreResultsBox or the Virtual Scrolling approaches.

You should properly set the WebServiceSettings tag of the combobox to point to the right asmx file, like:

CopyXML
<telerik:radcombobox 
    runat="server" 
    id="RadComboBox1" 
    height="200px" 
    width="300px"
    showmoreresultsbox="True" 
    enablevirtualscrolling="True" 
    enableloadondemand="True">            
    <WebServiceSettings Method="GetCustomers" Path="Products.asmx" />
</telerik:radcombobox>

In the WebService's method, you should pass a parameter (this parameter should be called context) of type RadComboBoxContext:

CopyXML
public RadComboBoxData GetCustomers(RadComboBoxContext context)

The context object is used to obtain:

  • The text entered in the input field by the user:context.Text

  • The number of items per requestcontext.NumberOfItems

Note

Note that the WebService's method is of type RadComboBoxData unlike the method used in the WebService when the ShowMoreResultsBox is disabled. Then, the WebService's method can be either of type RadComboBoxItemData or RadComboBoxData.

For a live example, see Load On Demand