BulletedList

The BulletedList control creates an unordered or ordered (numbered) list of items, which renders as an HTML UL or OL tag, respectively. You can specify the appearance of the items and of the bullets or numbers, define the list items statically or by binding the control to data, and you can respond to users' clicks on items.

To add a BulletedList control to a page

  • Drag the BulletedList control from the Toolbox panel to your page.

To bind the BulletedList control to a data source

  1. In Design view, right-click the BulletedList control, and then click Show Common Control Tasks.

    Tip

    You can also click the BulletedList control in Design view, click the arrow Cc295523.56557a2a-a4ef-4c47-906b-f64b8d530387(en-us,Expression.40).png in the upper-right corner to show the Common BulletedList Tasks menu. Click the arrow again to hide the menu.

  2. On the Common BulletedList Tasks menu, click Choose Data Source.

  3. In the Data Source Configuration Wizard, choose a source for the BulletedList control in the Select a data source dropdown. In the Select a data field to display in the BulletedList dropdown, select the field for the text that the user will see. In the Select a data field for the value of the BulletedList dropdown, select the field for the data that can be programmatically accessed when the user chooses an item in the list.

Defining List Items

You can define list items for the BulletedList control either by creating static items or by binding the control to a data source. You can combine static and data-bound list items by setting the control's AppendDataBoundItems property to true.

When you define items for the BulletedList control, you define two properties: the Text property and the Value property. The Text property defines what the control displays on the page. The Value property defines a second value that is not displayed but that you might want to return when a user selects an item. For example, you might display an employee name as the text of an item, but use the employee ID as the value; when users click the item, you can read the value directly.

To define items for the BulletedList control

  1. In Design view, right-click the BulletedList control, and then click Show Common Control Tasks.

  2. On the Common BulletedList Tasks menu, click Edit Items.

  3. In the ListItem Collection Editor dialog box, click Add to add an item.

  4. In the ListItem properties area, set the Text and Value properties.

  5. Repeat steps 3 and 4 until you have added all the items you want.

    Note

    Do not use sensitive data, such as customer numbers, for the Value property of a BulletedList control. Even though it is not visible, the Value property settings of individual items are rendered to the page, where users can easily read them in the page's source.

Customizing List Item Appearance

You can specify more display options for the BulletedList control in the Tag Properties panel.

To use the Tag Properties panel to set BulletedList properties

  1. Right-click the BulletedList control in Design view and click Properties in the shortcut menu.

  2. Type property values, or select them from dropdown lists where they are available.

The BulletedList control can render either bullets or numbers, according to the setting of the BulletStyle property. If the control is set to render bullets, you can select from predefined bullet style fields that match HTML standard bullet styles, such as those represented by the Disc, Circle, and Square fields.

Note

Individual browsers vary in how they render bullets, and some browsers do not support certain bullet styles, such as the Disc field.

You can also specify a custom image that will be displayed instead of the bullet.

If the control is set to render numbers, you can likewise select from HTML standard numbering options, such as the LowerAlpha, LowerRoman, and UpperAlpha fields. By setting the FirstBulletNumber property, you can also specify a starting number for the sequence.

Specifying Item Display Mode

The BulletedList control can display list items as any of the following:

  • Static text   The text displayed by the control is not interactive.

  • **HyperLinkcontrols   **Users can click links to navigate to another page. You must provide a target URL as the Value property of individual items.

  • **LinkButtoncontrols   **Users can click individual items and the control performs a postback.

Note

If you have set the DisplayMode property to HyperLink, specify the target URLs of the hyperlinks in each item's Value property.

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 BulletStyle property to one of the following enumeration values:

  • Numbered

  • LowerAlpha

  • UpperAlpha

  • LowerRoman

  • LowerRoman

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

  • Disc

  • Circle

  • Square

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

Responding to User Selection

For details on responding to user selection of items in your BulletedList control, see How to: Respond to User Clicks in BulletedList Web Server Controls Cc295523.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

For a full description of all BulletedList control properties, see BulletedList Properties Cc295523.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

See also

Concepts

Working with ASP.NET sites
ASP.NET Data controls
ASP.NET Validation controls
ASP.NET Navigation controls
ASP.NET Login controls
ASP.NET WebParts controls

Other resources

ASP.NET Standard controls

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.