$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
ListBox Feature Load on Demand in ASP.NET
Home > How to > ListBox Load On Demand

Information to Load on Demand Feature of ListBox

What is load on demand feature of ListBox Control? Load on demand function enables the application to load data from other sources into listbox only when it is requested. What are the benefits of using the load on demand feature in listbox creating application? When we need to load data from a large database, to ensure the whole web page will be loaded smoothly, we may load the items into listbox by segments, instead of loading all items at a time.
With the load on demand feature, new items will be loaded into the listbox when user moves the scrollbar of the listbox at the first time. Note: after you set the EnableLoadOnDemand property to true, please remember to set the value of Height property. If not, the load on demand feature will not be activated.

How to Utilize Load on Demand Function in ASP.NET

In this part, we will show you how use the load on demand feature in two situations.

Use load on demand feature when inputting data into listbox from database

If you bind data from existing database into target listbox, you can use following sample programming code for activating the load on demand functionality.
<kettic:PerListBox runat="server" ID="PerListBox1" CssClass="PerListBox2" Height="200px"
EnableLoadOnDemand="true" DataSourceID="SqlDataSource1" DataTextField="ShipName"
DataValueField="OrderID" DataKeyField="OrderID" Width="230px">
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [OrderID], [ShipName] FROM [Orders]"></asp:SqlDataSource>
Following image is used to represent the result of above ASP.NET listbox creating application.

Use load on demand feature when creating data dynamically in web page

Sometimes, we may need to create a listbox with data that is created dynamically in the web page. Under this condition, we will load data into listbox from web page instead of existing database. Still, we offer a sample C#.NET programming example for you to use the load on demand function with data created dynamically.
protected void Page_Load(object sender, EventArgs e)
PerListBox1.DataSource = GetData();

if (!Page.IsCallback)

private static int[] GetData()
var itemsCount = 5000;
var arr = new int[itemsCount];

for (var i = 0; i < itemsCount; i++)
arr[i] = i;
return arr;
The image attached below is used to show the output of above listbox load on demand activating application.

Other ListBox Related Features

Apart from the load on demand function, the PerListBox Control also offers other advanced item managing features, like