Controls You Can Use on Web Forms ASP.NET Standard Controls BulletedList Control
Basically, to create a working BulletedList control, you need to add the control to the page and set up the list items.
The below procedures show the minimum steps needed to display static data in a BulletedList control using declarative syntax.
- Declare an <
asp:bulletedlist
> element on the page. For syntax, see BulletedList Control Syntax.
- Set the DisplayMode property to specify how the control displays list items, to one of the following values:
Value |
Description |
Text |
Items are displayed as plain text. |
HyperLink |
Items are displayed as hyperlinks. |
LinkButton | Items are displayed as link buttons. |
- Set the BulletStyle property to specify whether the control displays items as bullets or as numbers.
To create a bulleted, or unordered, list, set the property to one of the following values:
To create a numbered, or ordered, list, set the property to one of the following values:
- Numbered
- LowerAlpha
- UpperAlpha
- LowerRoman
- UpperRoman
To display bullets as custom images, set the BulletStyle property to CustomImage, and set the BulletImageUrl property to the URL of the custom image to use. The same graphic is displayed for each item.
- Within the BulletedList declaration, define the <
asp:ListItem
> elements you intend to display, specifying at the very least the required Text property.
- If the BulletedList will be used for navigation, set each list item’s Value property to the destination URL of the list item.
- Otherwise, if the BulletedList will be used for item selection, set each list item’s Value property to store any additional data that you may want to pass to the postback event handler.
The below 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 id="navList"
displaymode="hyperlink"
target="_blank"
runat="server"
bulletstyle="customimage"
bulletimageurl="~/shared/razz.gif">
<asp:listitem text="MSN" value="http://www.msn.com"/>
<asp:listitem text="MSNBC News" value="http://www.msnbc.msn.com"/>
<asp:listitem text="Microsoft" value="http://www.microsoft.com"/>
<asp:listitem text="ASP.NET" value="http://www.asp.net"/>
<asp:listitem text="GotDotNet" value="http://www.gotdotnet.com"/>
<asp:listitem text="MSDN" value="http://msdn.microsoft.com"/>
<asp:listitem text="MSN Shopping" value="http://shopping.msn.com"/>
<asp:listitem text="MSN Autos" value="http://autos.msn.com"/>
<asp:listitem text="MapPoint" value="http://www.mappoint.com"/>
<asp:listitem text="MSN City Guides" value="http://local.msn.com"/>
<asp:listitem text="MSN Music" value="http://music.msn.com"/>
</asp:bulletedlist>
Show me
Adding BulletedList Items Programmatically Binding a BulletedList Control to a Data Source