List.ItemCommand イベント
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)

Dim instance As List Dim handler As ListCommandEventHandler AddHandler instance.ItemCommand, handler
public: event ListCommandEventHandler^ ItemCommand { void add (ListCommandEventHandler^ value); void remove (ListCommandEventHandler^ value); }

テンプレートを使ってリストをレンダリングする場合は、ASP.NET のイベントバブル機構を通じて ItemCommand イベント ハンドラが呼び出されます。このイベント ハンドラには、ソース項目に関する情報と、イベントの発生元のコントロールの CommandName プロパティが格納された、ListCommandEventArgs 型の引数が渡されます。これにより、単一のリスト項目に複数の対話操作を関連付けてレンダリングできます。
既定のレンダリングでは、ユーザーがリスト項目をクリックできる基本的なユーザー インターフェイス (UI) がコントロール上に提供されます。ポストバック時に ItemCommand イベント ハンドラが呼び出されるときには、ソース項目に関する情報が格納された ListCommandEventArgs 型の引数が渡されます。このオブジェクトの CommandName プロパティが null 参照 (Visual Basic では Nothing) です。

ItemCommand イベントを使用して、リスト内の項目のステータスを変更し、ステータスの合計を再計算するメソッドを呼び出す方法を次のコード例に示します。このコード例は、List の概要で取り上げているコード例の一部です。
Private Sub Status_ItemCommand(ByVal sender As Object, _ ByVal e As ListCommandEventArgs) Const spec As String = "You now have {0} tasks done, {1} " & _ "tasks scheduled, and {2} tasks pending." ' Move selection to next status toward 'done' Select Case e.ListItem.Value Case "scheduled" schedCount -= 1 pendCount += 1 e.ListItem.Value = "pending" Case "pending" pendCount -= 1 doneCount += 1 e.ListItem.Value = "done" End Select ' Show the status of the current task Label1.Text = e.ListItem.Text & " is " & _ e.ListItem.Value ' Show current selection counts Label2.Text = String.Format(spec, doneCount, _ schedCount, pendCount) End Sub
Private Sub Status_ItemCommand(ByVal sender As Object, _ ByVal e As ListCommandEventArgs) Const spec As String = "You now have {0} tasks done, {1} " & _ "tasks scheduled, and {2} tasks pending." ' Move selection to next status toward 'done' Select Case e.ListItem.Value Case "scheduled" schedCount -= 1 pendCount += 1 e.ListItem.Value = "pending" Case "pending" pendCount -= 1 doneCount += 1 e.ListItem.Value = "done" End Select ' Show the status of the current task Label1.Text = e.ListItem.Text & " is " & _ e.ListItem.Value ' Show current selection counts Label2.Text = String.Format(spec, doneCount, _ schedCount, pendCount) End Sub

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


Weblioに収録されているすべての辞書からList.ItemCommand イベントを検索する場合は、下記のリンクをクリックしてください。

- List.ItemCommand イベントのページへのリンク