select

ComboBox / Performance with Web Services

Rate this demo: Feedback
Run example in: C# VB.NET Change Skin:
Vista
  • BlackBlack
  • DefaultDefault
  • ForestForest
  • HayHay
  • Office2007Office2007
  • OutlookOutlook
  • SimpleSimple
  • SitefinitySitefinity
  • SunsetSunset
  • TelerikTelerik
  • VistaVista
  • Web20Web20
  • WebBlueWebBlue
  • Windows7Windows7

Load time:

Open the combobox to see the load time
Example Configuration

Example Source Code & Description

Instructions
Open in new window
  • This example demonstrates how to achieve the best performance with RadComboBox when dealing with large ammounts of data (items). The important steps are:
    1. Use Web Service load on demand.

      Web Service load on demand does not request the page and avoids the execution of the page life cycle. Less data is transferred between the client and the server.

    2. The using of EnabelItemCaching

      This property will save a time and use the result from the previous request with the same parameters.

    3. The implementation of the Web Service methods uses two optimization techniques to decrease the size of the generated JSON output:
      • The return type of the web method is IEnumerable. This prevents the serialization of the type name in the JSON output:
        [WebMethod]
        public IEnumerable GetItems(RadComboBoxContext context) 
        {
            int numberOfItems = 1000;
            List<ComboBoxItemData> items = new List<ComboBoxItemData>();
            for (int i = 0; i < numberOfItems; i++)
            {
                ComboBoxItemData itemData = new ComboBoxItemData();
                itemData.Text = "Item " + i;
                items.Add(itemData);
            }
        
            return items;
        }
        				
      • The web method returns only the data required by the application. In this case only the item's Text property is serialized by using a custom class - ComboBoxItemData. You should prefer this approach over using the RadComboBoxItemData or RadComboBox classes to preserve output size:
         class ComboBoxItemData
            {
                private string text;
        
                public string Text
                {
                    get { return text; }
                    set { text = value; }
                }
            }
        				

    The OnClientItemsRequesting and OnClientItemsRequested events are used only to measure the time requred to perform the load on demand operation. Consuming them is not required for the proper operation of RadComboBox in this scenario.

Compatible with ASP.NET 2.0, 3.5 AJAX enabled Optimized for Visual Studio 2005, 2008
Copyright 2002-2010 © Telerik. All right reserved  | 
Telerik Inc., 460 Totten Pond Rd, Suite 640, Waltham, MA 02451

www.telerik.com  |  Terms of Use  |  Contact Us