BulletedListDisplayMode 열거형

정의

BulletedList 컨트롤의 목록 항목 내용에 적용할 수 있는 표시 동작을 지정합니다.

public enum class BulletedListDisplayMode
public enum BulletedListDisplayMode
type BulletedListDisplayMode = 
Public Enum BulletedListDisplayMode
상속
BulletedListDisplayMode

필드

1

목록 항목 내용을 하이퍼링크로 표시합니다.

LinkButton 2

목록 항목 내용을 링크 단추로 표시합니다.

Text 0

목록 항목 내용을 텍스트로 표시합니다.

예제

다음 코드 예제에는 만드는 방법을 보여 줍니다는 BulletedList 제어 하 고 설정 된 DisplayMode 속성입니다. A ListBox 제어 채워집니다는 BulletedListDisplayMode 값입니다. 사용자가 목록 상자에서 선택한 표시 모드를 기준으로 하는 목록 항목 콘텐츠가 변경의 형식입니다.


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

설명

합니다 BulletedListDisplayMode 열거형에서 목록 항목의 내용에 적용할 수 있는 표시 동작을 나타냅니다는 BulletedList 제어 합니다. 합니다 BulletedList.DisplayMode 콘텐츠 항목 목록의 표시 동작을 설정 하려면 이러한 열거형 값을 사용 하는 속성을 BulletedList 제어 합니다. 예를 들어 속성을 값으로 HyperLink 설정 BulletedList.DisplayMode 하면 컨트롤의 각 목록 항목 내용이 BulletedList 하이퍼링크로 렌더링됩니다.

값을 Text 사용하면 추가 기능 없이 목록 항목 콘텐츠를 일반 텍스트로 표시할 수 있습니다.

값을 HyperLink 사용하면 목록 항목 콘텐츠를 하이퍼링크로 표시할 수 있습니다. 을 클릭할 때 하이퍼링크 URL로 이동 합니다. 사용 된 ListItem.Value 하이퍼링크 이동 하는 URL을 지정 하는 속성입니다.

값을 LinkButton 사용하면 목록 항목 콘텐츠를 링크 단추로 표시할 수 있습니다. 사용 된 BulletedList.Click 링크 단추를 클릭할 때 서버에 다시 게시 하는 이벤트입니다. 이벤트 데이터를 사용 합니다 BulletedListEventArgs 에서 링크 단추의 인덱스를 확인 하는 클래스는 BulletedList 사용자가 클릭 한 합니다.

적용 대상

추가 정보