BulletedList控制被用于用子弹建立格式化的项目名单。 要指定各自的名单项目您想要出现于BulletedList控制,安置每个词条的一个ListItem对象在BulletedList控制的开头和闭合值的标记之间。
列出子弹样式
BulletedList控制可能显示与各种各样的子弹样式的项目名单。 要控制半新的子弹样式,使用BulletedList.BulletSyle物产。 以下例子显示如何回报项目名单用圆子弹。
bulletedlist1_cs.aspx
![]()
Code
<html>
<head>
</head>
<body>
<h3><font face="Verdana">Bulleted List</font></h3>
<form runat=server>
<asp:BulletedList ID=BulletedList1 BulletStyle="Circle" runat=server>
<asp:ListItem>Item #1</asp:ListItem>
<asp:ListItem>Item #2</asp:ListItem>
<asp:ListItem>Item #3</asp:ListItem>
<asp:ListItem>Item #4</asp:ListItem>
</asp:BulletedList>
</form>
</body>
</html>
超链接名单
BulletedList控制可能也回报超链接名单。 BulletedList控制也提供一个方便方式回报超链接名单,作为选择到创造多各自的超链接控制。
要回报在名单的每个项目作为超链接,设置BulletedList.DisplayMode物产对BulletedListDisplayMode.HyperLink,并且设置每个名单项目价值物产对项目的航海URL。 超链接名单可能也显示与各种各样的子弹样式,如上所述。
bulletedlist2_cs.aspx
![]()
Code
<html>
<head>
</head>
<body>
<h3><font face="Verdana">Bulleted List</font></h3>
<form runat=server>
<asp:BulletedList DisplayMode = HyperLink runat=server>
<asp:ListItem Value="http://support.Microsoft.com">Support</asp:ListItem>
<asp:ListItem Value="http://www.asp.net">ASP.NET</asp:ListItem>
<asp:ListItem Value="http://msdn.microsoft.com">MSDN</asp:ListItem>
</asp:BulletedList>
</form>
</body>
</html>