- 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. 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 examples