BulletStyle Enumeration
Specifies the bullet styles you can apply to list items in a BulletedList control.
Assembly: System.Web (in System.Web.dll)
| Member name | Description | |
|---|---|---|
| Circle | The bullet style is an empty circle shape. | |
| CustomImage | The bullet style is a custom image. | |
| Disc | The bullet style is a filled circle shape. | |
| LowerAlpha | The bullet style is a lowercase letter (a, b, c, ...). | |
| LowerRoman | The bullet style is a lowercase Roman numeral (i, ii, iii, ...). | |
| NotSet | The bullet style is not set. The browser that renders the BulletedList control will determine the bullet style to display. | |
| Numbered | The bullet style is a number (1, 2, 3, ...). | |
| Square | The bullet style is a filled square shape. | |
| UpperAlpha | The bullet style is an uppercase letter (A, B, C, ...). | |
| UpperRoman | The bullet style is an uppercase Roman numeral (I, II, III, ...). |
The BulletStyle enumeration represents the bullet styles that you can apply to the list items in a BulletedList control. The BulletStyle property uses these enumeration values to set the bullet styles in a BulletedList control. For example, if you set the BulletStyle property to Disc, each list item in a BulletedList control will render a filled circle preceding the content of the list item as follows:
List Item 1
List Item 2
List Item 3
Specifying the CustomImage bullet style allows you to supply your own image for the bullet. If you specify the CustomImage bullet style, you must also set the BulletImageUrl property to the URL of the custom image to use.
If you specify NotSet, the browser in which the control is rendered will determine the bullet style to display with the list items in the BulletedList control.
The following example demonstrates how to create a BulletedList control. A ListBox control is populated with all available BulletStyle enumeration values. The bullet style changes based on the style that the user selects from the list box.
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>BulletStyle Example</title> <script runat="server"> Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs) ' Change the message displayed, based on ' the style selected from the list box. If BulletStylesListBox.SelectedIndex > -1 Then Message.Text = "You selected bullet style: " & BulletStylesListBox.SelectedItem.Text End If ' Change the bullet style used, based on ' the style selected from the list box. Select Case (BulletStylesListBox.SelectedIndex) Case 0 ItemsBulletedList.BulletStyle = BulletStyle.Numbered Case 1 ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha Case 2 ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha Case 3 ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman Case 4 ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman Case 5 ItemsBulletedList.BulletStyle = BulletStyle.Disc Case 6 ItemsBulletedList.BulletStyle = BulletStyle.Circle Case 7 ItemsBulletedList.BulletStyle = BulletStyle.Square Case 8 ItemsBulletedList.BulletStyle = BulletStyle.CustomImage ' Specify the path to the custom image to use for the bullet. ItemsBulletedList.BulletImageUrl = "Images/image1.jpg" Case 9 Message.Text = "You selected NotSet. The browser will determine the bullet style." Case Else Throw New Exception("You did not select a valid bullet style.") End Select End Sub </script> </head> <body> <form id="form1" runat="server"> <h3>BulletStyle Example</h3> <asp:BulletedList id="ItemsBulletedList" DisplayMode="Text" BulletStyle="NotSet" runat="server"> <asp:ListItem Value="0">Coho Winery</asp:ListItem> <asp:ListItem Value="1">Contoso, Ltd.</asp:ListItem> <asp:ListItem Value="2">Tailspin Toys</asp:ListItem> </asp:BulletedList> <hr /> <h4>Select a bullet type:</h4> <asp:ListBox id="BulletStylesListBox" SelectionMode="Single" Rows="1" OnSelectedIndexChanged="Index_Changed" AutoPostBack="True" runat="server"> <asp:ListItem Value="Numbered">Numbered</asp:ListItem> <asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem> <asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem> <asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem> <asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem> <asp:ListItem>Disc</asp:ListItem> <asp:ListItem>Circle</asp:ListItem> <asp:ListItem>Square</asp:ListItem> <asp:ListItem>CustomImage</asp:ListItem> <asp:ListItem Value="NotSet">NotSet</asp:ListItem> </asp:ListBox> <hr /> <asp:Label id="Message" runat="server" AssociatedControlID="BulletStylesListBox"/> </form> </body> </html>
Available since 2.0