BulletedList.DisplayMode プロパティ
アセンブリ: System.Web (system.web.dll 内)

Public Overridable Property DisplayMode As BulletedListDisplayMode
Dim instance As BulletedList Dim value As BulletedListDisplayMode value = instance.DisplayMode instance.DisplayMode = value
public: virtual property BulletedListDisplayMode DisplayMode { BulletedListDisplayMode get (); void set (BulletedListDisplayMode value); }
/** @property */ public BulletedListDisplayMode get_DisplayMode () /** @property */ public void set_DisplayMode (BulletedListDisplayMode value)
public function get DisplayMode () : BulletedListDisplayMode public function set DisplayMode (value : BulletedListDisplayMode)
BulletedListDisplayMode 値の 1 つ。既定値は Text です。


BulletedList コントロールのリスト項目の内容に適用する表示動作を指定するには、DisplayMode プロパティを使用します。DisplayMode プロパティは、BulletedListDisplayMode 列挙値の 1 つを使用して設定します。有効値の一覧を次の表に示します。
HyperLink 値を使用すると、リスト内容をハイパーリンクとして表示できます。ハイパーリンクをクリックすると、参照先の URL に移動します。ハイパーリンクの移動先の URL を指定するには、Value プロパティを使用します。
LinkButton フィールドを使用すると、リスト内容をリンクとして表示できます。リンク ボタンがクリックされたときにサーバーにポストバックするには、BulletedList.Click イベントを使用します。
Topic | Location |
---|---|
方法 : Web フォーム ページに BulletedList Web サーバー コントロールを追加する | ASP .NET Web アプリケーションの作成 |
方法 : Web フォーム ページに BulletedList Web サーバー コントロールを追加する (Visual Studio) | Visual Studio での ASP .NET Web アプリケーションの作成 |

BulletedList コントロールを作成して、 DisplayMode プロパティを設定する方法を、次のコード例で示します。ListBox コントロールには、BulletedListDisplayMode 列挙値が設定されます。リスト項目の内容の書式は、ユーザーがリスト ボックスから選択した表示モードに基づき変わります。
<%@ Page Language="VB" %> <html> <head> <script runat="server"> Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs) ' Change the message displayed, based on ' the display mode selected from the list box. If DisplayModeListBox.SelectedIndex > -1 Then Message1.Text = "You chose: " & DisplayModeListBox.SelectedItem.Text End If ' Change the display mode, based on ' the mode selected from the list box. Select Case (DisplayModeListBox.SelectedIndex) Case 0 ItemsBulletedList.DisplayMode = BulletedListDisplayMode.Text Message2.Text = "" Case 1 ItemsBulletedList.DisplayMode = BulletedListDisplayMode.HyperLink ' Opens a new browser window to display the page linked to. ItemsBulletedList.Target = "_blank" Message2.Text = "" Case 2 ItemsBulletedList.DisplayMode = BulletedListDisplayMode.LinkButton Case Else Throw New Exception("You did not select a valid display mode.") End Select End Sub Sub ItemsBulletedList_Click(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.BulletedListEventArgs) ' Change the message displayed, based on the index ' of the bulletedlist list item that was clicked. Select Case (e.Index) Case 0 Message2.Text = "You clicked list item 1." Case 1 Message2.Text = "You clicked list item 2." Case 2 Message2.Text = "You clicked list item 3." Case Else Throw New Exception("You did not click a valid list item.") End Select End Sub </script> </head> <body> <h3>DisplayMode Example</h3> <form ID="Form1" runat="server"> <h3>BulletedListDisplayMode Example</h3> <asp:BulletedList id="ItemsBulletedList" BulletStyle="Disc" DisplayMode="Text" OnClick="ItemsBulletedList_Click" runat="server"> <asp:ListItem Value="http://www.cohowinery.com">Coho Winery</asp:ListItem> <asp:ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp:ListItem> <asp:ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp:ListItem> </asp:BulletedList></P> <hr> <h4>Select from the list to change the display mode:</h4> <asp:ListBox id="DisplayModeListBox" Rows="1" SelectionMode="Single" AutoPostBack="True" OnSelectedIndexChanged="Index_Changed" runat="server"> <asp:ListItem>Text</asp:ListItem> <asp:ListItem>Hyperlink</asp:ListItem> <asp:ListItem>LinkButton</asp:ListItem> </asp:ListBox> <asp:Label id="Message1" runat="server"/><br><br> <asp:Label id="Message2" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


BulletedListDisplayMode 列挙体
アセンブリ: System.Web (system.web.dll 内)

Public Enumeration BulletedListDisplayMode

メンバ名 | 説明 | |
---|---|---|
HyperLink | リスト項目の内容をハイパーリンクとして表示します。 | |
LinkButton | リスト項目の内容をリンク ボタンとして表示します。 | |
Text | リスト項目の内容をテキストとして表示します。 |

BulletedListDisplayMode 列挙値は、BulletedList コントロールのリスト項目の内容に適用できる表示動作を表します。DisplayMode プロパティでは、これらの列挙値を使用して、BulletedList コントロールのリスト項目の内容の表示動作を設定します。たとえば、DisplayMode プロパティに HyperLink 値を設定すると、BulletedList コントロールの各リスト項目の内容はハイパーリンクとして表示されます。
Text 値を使用すると、リスト項目の内容を、追加機能のない通常のテキストとして表示できます。
HyperLink 値を使用すると、リスト項目の内容をハイパーリンクとして表示できます。ハイパーリンクをクリックすると、参照先の URL に移動します。ハイパーリンクの移動先の URL を指定するには、Value プロパティを使用します。
LinkButton 値を使用すると、リスト項目の内容をリンク ボタンとして表示できます。BulletedList.Click イベントを使用すると、ユーザーがリンク ボタンをクリックしたときに、サーバーにポストバックできます。ユーザーがクリックした BulletedList 内のリンク ボタンのインデックスを特定するには、BulletedListEventArgs クラスのイベント データを使用します。

次のコード例は、BulletedList コントロールを作成して、 DisplayMode プロパティを設定する方法を示しています。ListBox コントロールには、BulletedListDisplayMode 値が設定されます。リスト項目の内容の書式は、ユーザーがリスト ボックスから選択した表示モードに基づき変わります。
<%@ Page Language="VB" %> <html> <head> <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"/> </form> </body> </html>
<%@ Page Language="C#" %> <html> <head> <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" /> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- BulletedListDisplayModeのページへのリンク