- How to data bind a BulletedList on page load event

Data bind BulletedList on page load
BulletedList is an web server control. BulletedList control render an unordered and ordered (numbered) list of items as HTML ul or ol elements in web browser. BulletedList contains an items collection object which hold all ListItem objects. ASP.NET developers can populate a BulletedList control using declarative syntax by placing ListItem objects between opening and closing BulletedList tags.

BulletedList control also support data binding. So we can populate a BulletedList control with items by data binding with a data source. BulletedList can data bind with many data source such as SqlDataSource, ObjectDataSource, LinqDataSource, AccessDataSource, Array etc.

To bind a data source object with BulletedList control, first we need to create a data source object. next we need to call the BulletedList DataBind method.

In this example, first we create an array data source then data bind this array with a BulletedList control. we data bind BulletedList on page load event. we can extend this example by data binding BulletedList only first time the page loaded, not every post back.

The following c# example code demonstrate us how can we data bind a BulletedList control programatically on page load event.

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e)
        string[] controls = { "FileUpload", "Calendar", "Button", "Literal", "Panel" };
        BulletedList1.DataSource = controls;

<html xmlns="">
<head id="Head1" runat="server">
    <title>How to data bind BulletedList on page load</title>
    <form id="form1" runat="server">
        <h2 style="color:Navy">BulletedList: DataBind()</h2>
             Text=" controls"
More example