ListCommandEventArgs クラス
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)


ListCommandEventArgs オブジェクトを使用して、項目がクリックされたときにリスト内のタスクのステータスを変更する方法を次のコード例に示します。このコード例は、List の概要で取り上げているコード例の一部です。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
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


System.EventArgs
System.Web.UI.WebControls.CommandEventArgs
System.Web.UI.MobileControls.ListCommandEventArgs


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ListCommandEventArgs クラスのページへのリンク