SelectionList クラスとは? わかりやすく解説

SelectionList クラス

選択可能な項目のリスト複数異な方法ビジュアルに表示します

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

<ValidationPropertyAttribute("Selection")> _
Public Class SelectionList
    Inherits MobileControl
    Implements IPostBackDataHandler
Dim instance As SelectionList
[ValidationPropertyAttribute("Selection")] 
public class SelectionList : MobileControl,
 IPostBackDataHandler
[ValidationPropertyAttribute(L"Selection")] 
public ref class SelectionList : public
 MobileControl, IPostBackDataHandler
/** @attribute ValidationPropertyAttribute("Selection") */ 
public class SelectionList extends MobileControl
 implements IPostBackDataHandler
ValidationPropertyAttribute("Selection") 
public class SelectionList extends
 MobileControl implements IPostBackDataHandler
解説解説

SelectionList クラスは、選択され単一項目または複数項目の選択内容保持しますSelectionList は MobileControl クラスから直接派生し、ItemWeight プロパティなど、改ページ位置の自動修正を扱うプロパティ備えていません。

使用例使用例

次のコード例では、SelectionList クラスの DataSource プロパティは、最初にページ読み込むときに作成される値の配列です。SelectType プロパティ設定変更すると、異な形式SelectionList確認できます

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要があります詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage"
 %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls"
 
    Assembly="System.Web.Mobile"
 %>

<script runat="server">
    Public Sub Page_Load(ByVal
 sender As Object, ByVal
 e As EventArgs)
        If Not IsPostBack Then
            Label1.Text = "Select an item"

            ' Create and fill an array list.
            Dim listValues As New
 ArrayList()
            listValues.Add("One")
            listValues.Add("Two")
            listValues.Add("Three")

            ' Bind the array to the list.
            SelList1.DataSource = listValues
            SelList1.DataBind()

            ' Set the SelectType.
            SelList1.SelectType = ListSelectType.Radio
        Else
            If (SelList1.SelectedIndex > -1) Then
                ' To show the selection, use the Selection property.
                Label1.Text = "Your selection is "
 & _
                    SelList1.Selection.Text

                ' Or, show the selection by using 
                ' the MobileListItemCollection class.
                ' Get the index of the selected item
                Dim idx As Integer
 = SelList1.SelectedIndex
                Label2.Text = "You have selected "
 & _
                    SelList1.Items(idx).Text

                ' Insert a copy of the selected item
                Dim mi As MobileListItem =
 SelList1.Selection
                Label3.Text = "The index of your selection is
 " & _
                    mi.Index.ToString()
                SelList1.Items.Insert(idx, _
                    New MobileListItem(mi.Text + "
 Copy"))
            Else
                Label1.Text = "No items selected"
            End If
        End If
    End Sub
</script>

<html xmlns="http:'www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Label id="Label1" runat="server"
 
            Text="Show a list" />
        <mobile:Label id="Label2" runat="server"
 />
        <mobile:Label id="Label3" runat="server"
 />
        <mobile:SelectionList runat="server" 
            id="SelList1" />
        <mobile:Command id="Command1" runat="server"
 
            Text=" OK " />
    </mobile:form>
</body>
</html>
<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    public void Page_Load(Object sender, EventArgs
 e)
    {
        if (!IsPostBack)
        {
            Label1.Text = "Select an item";

            // Create and fill an array list.
            ArrayList listValues = new ArrayList();
            listValues.Add("One");
            listValues.Add("Two");
            listValues.Add("Three");

            // Bind the array to the list.
            SelList1.DataSource = listValues;
            SelList1.DataBind();

            // Set the SelectType.
            SelList1.SelectType =
                System.Web.UI.MobileControls.ListSelectType.Radio;
        }
        else
        {
            if (SelList1.SelectedIndex > -1)
            {
                // To show the selection, use the Selection property.
                Label1.Text = "Your selection is " +
                    SelList1.Selection;

                // Or, show the selection by using 
                // the MobileListItemCollection class.
                // Get the index of the selected item
                int idx = SelList1.SelectedIndex;
                Label2.Text = "You have selected " +
                    SelList1.Items[idx].Text;

                // Insert a copy of the selected item
                MobileListItem mi = SelList1.Selection;
                Label3.Text = "The index of your selection is " + 
                    mi.Index.ToString();
                SelList1.Items.Insert(idx, 
                    new MobileListItem(mi.Text + " Copy"));
            }
            else
            {
                Label1.Text = "No items selected";
            }
        }
    }
</script>

<html  >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Label id="Label1" runat="server" 
            Text="Show a list" />
        <mobile:Label id="Label2" runat="server" />
        <mobile:Label id="Label3" runat="server" />
        <mobile:SelectionList runat="server" 
            id="SelList1" />
        <mobile:Command id="Command1" runat="server" 
            Text=" OK " />
    </mobile:form>
</body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.MobileControls.MobileControl
      System.Web.UI.MobileControls.SelectionList
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SelectionList クラス」の関連用語

SelectionList クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SelectionList クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS