JavaScript Editor jscript editor     Web designer 

Main Page

The BulletedList control creates an unordered or ordered (numbered) list of items, which renders as an HTML ul or ol element, 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.

Defining List Items

The BulletedList derives from the same ListControl class as the ListBox, DropDownList, and other ASP.NET list controls, so using it is similar to working with those controls. You can define list items for the BulletedList control either by creating static items or by binding the control to a data source. If you know at design time what items you want to display, you can set the control's Items collection to a set of individual items in markup. If the items to be displayed are dynamic, you can create the item collection in code at run time. For details, see How to: Add Items in List Web Server Controls.

Alternatively, you can bind the control to a data source that contains the information you want to display. For details, see How to: Populate List Web Server Controls from 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.

Security noteSecurity 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

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.


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, UpperAlpha, 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.

  • T:System.Web.UI.WebControls.HyperLink controlsВ В В Users can click links to navigate to another page. You must provide a target URL as the Value property of individual items.

  • LinkButton controlsВ В В Users can click individual items and the control performs a postback.

Responding to User Selection

If the BulletedList control is configured to display individual items as LinkButton controls, the control performs a postback when a user clicks an item. The postback raises the BulletedList control's Click event, where you can provide logic to perform application-specific tasks. The event passes to you the index number of the item that was clicked. For details, see How to: Respond to User Clicks in BulletedList Web Server Controls.

See Also



JavaScript Editor jscript editor     Web designer