List.ItemDataBind イベントとは? わかりやすく解説

List.ItemDataBind イベント

List 内の項目がデータバインドされたときに発生します

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

Public Event ItemDataBind As
 ListDataBindEventHandler
Dim instance As List
Dim handler As ListDataBindEventHandler

AddHandler instance.ItemDataBind, handler
public event ListDataBindEventHandler ItemDataBind
public:
event ListDataBindEventHandler^ ItemDataBind {
    void add (ListDataBindEventHandler^ value);
    void remove (ListDataBindEventHandler^ value);
}
/** @event */
public void add_ItemDataBind (ListDataBindEventHandler
 value)

/** @event */
public void remove_ItemDataBind (ListDataBindEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説

List 内の項目が作成されデータ バインドされると、このイベント ハンドラが、任意の式からそのリスト項目のプロパティ設定しますList 内の項目は、MobileListItem 型です。このイベントは、各データ ソース項目がバインドされたときに発生しますText プロパティまたは Value プロパティ使用して MobileListItemCollection コレクション内の項目のフィルタ処理またはグループ化を行うには、このイベントの発生時が最も適切なタイミングです。

使用例使用例

ItemDataBind イベント使用してリストステータス設定開始時の合計取得する方法コード例次に示します。このコードは、List概要取り上げているコード例一部分です。

Private Sub Status_DataBinding(ByVal
 sender As Object, _
    ByVal e As ListDataBindEventArgs)

    ' Increment initial counts
    Select Case e.ListItem.Value
        Case "done"
            doneCount += 1
        Case "scheduled"
            schedCount += 1
        Case "pending"
            pendCount += 1
    End Select
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    If Not IsPostBack Then
        ' Set the DataMembers of the List
        List1.DataValueField = "Status"
        List1.DataTextField = "TaskName"

        ' Create an ArrayList of task data
        Dim arr As ArrayList = New ArrayList()
        arr.Add(New Task("Define transactions", "scheduled"))
        arr.Add(New Task("Verify transactions", "scheduled"))
        arr.Add(New Task("Check balance sheet", "scheduled"))
        arr.Add(New Task("Compile balance sheet", "scheduled"))
        arr.Add(New Task("Prepare report", "scheduled"))
        arr.Add(New Task("Send report", "scheduled"))
        
        ' Bind the array to the list
        List1.DataSource = arr
        List1.DataBind()

        Const spec As String = "Start: {0} tasks are done, {1} " &
 _
           "tasks are scheduled, and {2} tasks are pending."
        Label2.Text = String.Format(spec, doneCount, _
            schedCount, pendCount)

        List1.Decoration = ListDecoration.Bulleted
    End If
End Sub

Private Sub Status_DataBinding(ByVal sender As Object, _
    ByVal e As ListDataBindEventArgs)

    ' Increment initial counts
    Select Case e.ListItem.Value
        Case "done"
            doneCount += 1
        Case "scheduled"
            schedCount += 1
        Case "pending"
            pendCount += 1
    End Select
End Sub
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
List クラス
List メンバ
System.Web.UI.MobileControls 名前空間
ListDataBindEventArgs
ObjectList
ObjectListDataBindEventArgs
SelectionList
OnItemDataBind
その他の技術情報
List コントロール概要



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

辞書ショートカット

すべての辞書の索引

「List.ItemDataBind イベント」の関連用語

List.ItemDataBind イベントのお隣キーワード
検索ランキング

   

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



List.ItemDataBind イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS