System.Web.UI.WebControls Namespace BulletedList Class
.NET Framework version 2.0
Sets or retrieves the display mode of the list content in a BulletedList control.
Inline |
<asp:bulletedlist displaymode = enumValue ... > |
Script |
BulletedList.DisplayMode = [ enumValue ] |
The property is read/write with a default value of Text.
Use the DisplayMode property to specify the display behavior of the list items in a BulletedList control.
When not specified, DisplayMode defaults to the Text value, which displays the list item content as regular text with no additional functionality.
Setting DisplayMode to HyperLink specifies that the control displays the list content as hyperlinks which, when clicked, navigates to a URL. To specify the URL that a hyperlink navigates to, use the Value property.
Setting DisplayMode to LinkButton specifies that the control displays the list content as link buttons which, when clicked, posts the Web Form back to the server. In this case, the Value property can be used to associate a value for each list item that is passed on to the postback event handler.
To respond to the postback event, specify a handler for the Click event, using the event data of the BulletedListEventArgs class to determine the index of the link button in a BulletedList that the user clicked.
The following example shows how to declaratively set the DisplayMode property of a BulletedList control at design time.
<asp:bulletedlist id = "bulletedList" runat = "server"
bulletstyle = "disc"
displaymode = "hyperlink"
target = "_blank">
<asp:listitem value = "http://www.microsoft.com">Microsoft</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>
The following examples demonstrate using the DisplayMode property to specify the different display behaviors that can be applied to list items in a BulletedList control.
BulletedList Members