Freigeben über


How to: Add BulletedList Web Server Controls to a Web Forms Page

The BulletedList control can display static text in a list that is either unordered (bulleted) or ordered (numbered).

To add a BulletedList Web server control to a Web Forms page

  1. Add an <asp:BulletedList> element to the page.

  2. Set the BulletedList control's DisplayMode property to one of the following values to specify how the control displays list items:

    • Text   Items are displayed as plain text.

    • HyperLink   Items are displayed as hyperlinks.

    • LinkButton   Items are displayed as link buttons.

  3. Add list items to the control in one of the following ways:

  4. Set the BulletStyle property to specify whether the control displays items as bullets or as numbers. To create a numbered, or ordered, list, set the property to one of the following enumeration values:

    To create a bulleted, or unordered, list, set the property to one of the following values:

    To display bullets as custom images, set the BulletStyle property to the URL of a graphic. The same graphic is displayed for each item.

Example

The example shows a BulletedList control that is configured to display the list items as hyperlinks. The control contains statically defined items in which the URLs of the hyperlinks are defined in the Value property of each item. The control is also configured to display a custom image as the bullet.

<asp:BulletedList
    BulletImageUrl="~/Images/bullet1.JPG"
    BulletStyle="CustomImage"
    DisplayMode="HyperLink"
    ID="BulletedList1"
    runat="server">
    <asp:ListItem
        Value="https://www.contoso.com/">Contoso</asp:ListItem>
    <asp:ListItem
        Value="https://www.asp.net/">ASP.NET</asp:ListItem>
</asp:BulletedList>

See Also

Concepts

BulletedList Web Server Control Overview