Version

Load-on-demand

WebDropDown™ supports load-on-demand. If load-on-demand is enabled, the end-user should first be able to see a scrollbar in the dropdown container, and if they scroll to the end of the list more items are fetched and appended at the bottom of the list through asynchronous callbacks. Enabling load-on-demand significantly reduces the bandwidth and processing overhead on both the server and the client. The data loading message can be set by using the WebDropDown control’s LoadingItemsMessageText property.

To enable load-on-demand, theWebDropDown control’s EnableLoadOnDemand property must be set to True. By default, this property is set to False. You can set the EnableLoadOnDemand property by using the Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

WebDropDown1.EnableLoadOnDemand = true

In C#:

WebDropDown1.EnableLoadOnDemand = true;
Note
Note:

Load-on-demand cannot be used with paging. If both load-on-demand and paging are enabled, unexpected results will occur.

Using load-on-demand in WebDropDown

The example below expects that you will be using the Customers table of the Northwind database.

  1. From the Visual Studio™ Toolbox, drag and drop a ScriptManager component, a WebDropDown control and a SqlDataSource component.

  2. Bind WebDropDown to the Categories table of the Northwind database. For more information on how to bind WebDropDown to a SqlDataSource, see Binding WebDropDown to a Sql Data Source.

  3. Set the WebDropDown control’s TextField property to CompanyName.

  4. Set the WebDropDown control’s DropDownContainerHeight and DropDownContainerWidth properties to 200px. You can set these properties in the property window or through the following code:

In Visual Basic:

WebDropDown1.DropDownContainerHeight = 200;WebDropDown1.DropDownContainerWidth = 200;

In C#:

WebDropDown1.DropDownContainerHeight = 200;
WebDropDown1.DropDownContainerWidth = 200;
  1. Enable load-on-demand by setting the EnableDropDown property through the property window or using the following code :

In Visual Basic:

WebDropDown1.EnableLoadOnDemand = true

In C#:

WebDropDown1.EnableLoadOnDemand = true;
  1. Save and run your application. You will observe that once you scroll down the end of the list you will see more items added to the drop-down container.