Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
    • Overview
    • Installation & Deployement
    • EO.Web ToolTip
    • EO.Web Rating
    • EO.Web Slider & RangeSlider
    • EO.Web ListBox
    • EO.Web ComboBox
    • EO.Web Captcha
    • EO.Web ASPX To PDF
    • EO.Web Slide
    • EO.Web Flyout
    • EO.Web EditableLabel
    • EO.Web ImageZoom
    • EO.Web Floater
    • EO.Web Downloader
    • EO.Web ColorPicker
    • EO.Web HTML Editor
    • EO.Web File Explorer
    • EO.Web SpellChecker
    • EO.Web Grid
    • EO.Web MaskedEdit
    • EO.Web Splitter
    • EO.Web Menu
    • EO.Web Slide Menu
    • EO.Web TabStrip
    • EO.Web TreeView
    • EO.Web Calendar
    • EO.Web Callback
    • EO.Web MultiPage
    • EO.Web Dialog
    • EO.Web AJAXUploader
    • EO.Web ProgressBar - Free!
    • EO.Web ToolBar - Free!
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
Load On Demand

EO.Web ListBox supports load on demand. When load on demand is enabled, the ListBox does not load all items at once. Instead it loads additional items as user scrolls down the list.

Loading Initial Items

To enable load on demand feature, you must set the ListBox's TotalItemCount property, then load fewer items than TotalItemCount. For example, the following code set TotalItemCount to 100, but only loads 10 items initially during the page's Page_Load event:

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        //Set total item count 100
        ListBox1.TotalItemCount = 100;
        
        //But only add 10 items into the ListBox
        for (int i = 0; i < 10; i++)
        {
            EO.Web.ListBoxItem item = new EO.Web.ListBoxItem("item");
            ListBox1.Items.Add(item);
        }
    }
}

Loading Additional Items

Once load on demand is enabled, the ListBox will display a scrollbar based on TotalItemCount as if it had more items. However as soon as user scrolls down to the bottom, the ListBox will trigger MoreItemsNeeded event to request more items. You must handle this event to add more items into the ListBox.