BulletedListDisplayMode BulletedListDisplayMode BulletedListDisplayMode BulletedListDisplayMode Enum

Definition

Gibt die Anzeigeverhalten an, die Sie auf den Inhalt der Listenelemente in einem BulletedList-Steuerelement anwenden können.Specifies the display behaviors that you can apply to the list item contents in a BulletedList control.

public enum class BulletedListDisplayMode
public enum BulletedListDisplayMode
type BulletedListDisplayMode = 
Public Enum BulletedListDisplayMode
Vererbung
BulletedListDisplayModeBulletedListDisplayModeBulletedListDisplayModeBulletedListDisplayMode

Felder

1

Zeigt den Inhalt der Listenelemente als Links an.Displays the list item content as hyperlinks.

LinkButton LinkButton LinkButton LinkButton 2

Zeigt den Inhalt der Listenelemente als Linkschaltflächen an.Displays the list item content as link buttons.

Text Text Text Text 0

Zeigt den Inhalt der Listenelemente als Text an.Displays the list item content as text.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie ein BulletedList -Steuerelement erstellt DisplayMode und die-Eigenschaft festgelegt wird.The following code example demonstrates how to create a BulletedList control and set the DisplayMode property. Ein ListBox -Steuerelement wird mit BulletedListDisplayMode den-Werten aufgefüllt.A ListBox control is populated with the BulletedListDisplayMode values. Das Format des Listenelement Inhalts ändert sich auf der Grundlage des Anzeigemodus, den der Benutzer aus dem Listenfeld auswählt.The format of the list item content changes based on the display mode that the user selects from the list box.


<%@ Page Language="C#" %>

<!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">       
        protected void Index_Changed(object sender, EventArgs e)
        {
            // Change the message displayed, based on 
            // the style selected from the list box.
            if (BulletStylesListBox.SelectedIndex > -1)
            {
                Message.Text = "You selected bullet style: " +
                    BulletStylesListBox.SelectedItem.Text;
            }

            // Change the bullet style used, based on 
            // the style selected from the list box.
            switch (BulletStylesListBox.SelectedIndex)
            {
                case 0:
                    ItemsBulletedList.BulletStyle = BulletStyle.Numbered;
                    break;
                case 1:
                    ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha;
                    break;
                case 2:
                    ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha;
                    break;
                case 3:
                    ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman;
                    break;
                case 4:
                    ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman;
                    break;
                case 5:
                    ItemsBulletedList.BulletStyle = BulletStyle.Disc;
                    break;
                case 6:
                    ItemsBulletedList.BulletStyle = BulletStyle.Circle;
                    break;
                case 7:
                    ItemsBulletedList.BulletStyle = BulletStyle.Square;
                    break;
                case 8:
                    ItemsBulletedList.BulletStyle = BulletStyle.CustomImage;
                    // Specify the path to the custom image to use for the bullet.
                    ItemsBulletedList.BulletImageUrl = "Images/image1.jpg";
                    break;
                case 9:
                    Message.Text = "You selected NotSet. The browser will determine the bullet style.";
                    break;
                default:
                    throw new Exception("You did not select a valid bullet style.");
            }

        }
</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>
<%@ 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>

Hinweise

Die BulletedListDisplayMode -Enumeration stellt die Anzeigeverhalten dar, die Sie auf den Inhalt der Listenelemente in einem BulletedList -Steuerelement anwenden können.The BulletedListDisplayMode enumeration represents the display behaviors that you can apply to the content of the list items in a BulletedList control. Die BulletedList.DisplayMode -Eigenschaft verwendet diese Enumerationswerte, um das Anzeigeverhalten des Listenelement Inhalts in BulletedList einem-Steuerelement festzulegen.The BulletedList.DisplayMode property uses these enumeration values to set the display behavior of the list item content in a BulletedList control. Wenn Sie z. b. die BulletedList.DisplayMode -Eigenschaft auf HyperLink den Wert festlegen, wird der Inhalt der BulletedList einzelnen Listenelemente im-Steuerelement als Hyperlink gerendert.For example, if you set the BulletedList.DisplayMode property to the HyperLink value, the content of each list item in the BulletedList control renders as a hyperlink.

Der Text Wert ermöglicht es Ihnen, den Inhalt des Listen Elements als regulären Text ohne zusätzliche Funktionalität anzuzeigen.The Text value allows you to display the list item content as regular text with no additional functionality.

Der HyperLink -Wert ermöglicht Ihnen das Anzeigen von Listenelement Inhalten als Hyperlinks.The HyperLink value allows you to display list item content as hyperlinks. Wenn Sie darauf klicken, wird ein Link zu einer URL navigiert.When clicked, a hyperlink navigates to a URL. Verwenden Sie ListItem.Value die-Eigenschaft, um die URL anzugeben, zu der ein Link navigiert.Use the ListItem.Value property to specify the URL that a hyperlink navigates to.

Der LinkButton Wert ermöglicht Ihnen das Anzeigen von Listenelement Inhalten als Link Schaltflächen.The LinkButton value allows you to display list item content as link buttons. Verwenden Sie BulletedList.Click das-Ereignis, um an den Server zurückzukehren, wenn der Benutzer auf eine Link Schaltfläche klickt.Use the BulletedList.Click event to post back to the server when the user clicks a link button. Verwenden Sie die Ereignisdaten der BulletedListEventArgs -Klasse, um den Index der Link Schaltfläche BulletedList in einem zu ermitteln, auf den der Benutzer geklickt hat.Use the event data of the BulletedListEventArgs class to determine the index of the link button in a BulletedList that the user clicked.

Gilt für:

Siehe auch