Simple Page With Data Binding : BulletedList « Data Binding « ASP.NET Tutorial






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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">    
string[] _displayItemData = {"Item #1", "Item #2", "Item #3", "Item #4", "Item #5",
    "Item #6", "Item #7", "Item #8", "Item #9", "Item #10"};

protected override void OnLoad(EventArgs e)
{
    _messageH2.InnerText = "Total number of items = " + _displayItemData.Length.ToString();

   _displayItems.DataSource = _displayItemData;
   _displayItems.DataBind();
          
    base.OnLoad(e);
}    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Simple page with controls</title>
</head>
<body>
    <form runat="server" id="_form">
        <h1>Test ASP.NET 2.0 Page with data binding</h1>
        
        <asp:BulletedList runat="server" ID="_displayItems">
            <asp:ListItem>Sample item 1</asp:ListItem>
            <asp:ListItem>Sample item 2 ...</asp:ListItem>
        </asp:BulletedList>
        
        <h2 runat="server" id="_messageH2">Total number of items = xx</h2>
    </form>
</body>
</html>








19.2.BulletedList
19.2.1.BulletedList Control data binding with asp:SqlDataSource
19.2.2.BulletStyle property
19.2.3.DisplayMode property: BulletedList DisplayMode enumeration
19.2.4.Simple Page With Data Binding
19.2.5.Page with declarative data binding