Optimizing the Combobox
The best approach to optimize the performance speed of Telerik RadComboBox when using huge amount of items is using the load-on-demand feature. The load-on-demand mechanism loads the items only when the user types or clicks in the field or the drop-arrow image. You can also load the items only upon clicking on the drop arrow. To do this you should set the ShowDropDownOnTextboxClick property to false. For even faster load of the page, you can leave the combobox empty when it is first rendered on the page. Items will be added as soon as the user clicks in the input field, the drop-arrow image or types some text into the input field. In other words, you can add the items only in the ItemsRequested event handler or via WebService.
It is important to test the performance only when debugging is disabled. Set <compilation debug="false" />
in the web.config. When it is true, the MS AJAXdebugging code causes a severe performance hit on the client-side. The fact that most of the editor functionalities implemented in JavaScript, thus resulting in 10 times slower performance compared to native compiled code.
When using the load-on-demand mechanism with ItemsRequested event you should:
-
Set the EnableLoadOnDemand property to true.
-
Subscribe to the ItemsRequested event and add the items there.
<telerik:RadComboBox RenderMode="Lightweight"
id="RadComboBox1"
runat="server"
EnableLoadOnDemand="true"
OnItemsRequested="RadComboBox1_ItemsRequested">
</telerik:RadComboBox>
protected void RadComboBox1_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
RadComboBox1.Items.Add(new RadComboBoxItem("item 1", "1"));
RadComboBox1.Items.Add(new RadComboBoxItem("item 2", "2"));
}
ShowMoreResultsBox and EnableVirtualScrolling
When you load the combobox items from heavy database, you can cache the data source so that additional calls are avoided. This will make the combobox even faster.
A sample project can be seen here: Load On Demand