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

public: event CommandEventHandler^ ItemCommand { void add (CommandEventHandler^ value); void remove (CommandEventHandler^ value); }

ItemCommand イベント ハンドラが定義されると、ユーザーとの対話で項目イベントが生成されるときに、Command コントロールからハンドラに対して通知されます。
Click イベントとは異なり、ItemCommand イベントは、親コントロールに通知されます。レンダリングする ItemCommand イベントは、デバイス固有のイベントです。詳細については、System.Web.UI.MobileControls.Command の「デバイス固有の動作」セクションで説明しています。
OnItemCommand イベントは、OnClick イベントの後で発生します。コマンド ボタンがクリックされるたびに同じ一連の操作を繰り返す場合、Command コントロールの CommandName プロパティと CommandArgument プロパティのいずれかを使用すると、ユーザーがクリックしたコマンド ボタンを識別できます。

ページ上の複数のコマンドに対して ItemCommand イベントを使用する方法を次のコード例に示します。
<%@ Page Language="VB" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Private Sub cmd_OnItemCommand(ByVal sender As Object, ByVal e As CommandEventArgs) ' Create variables for data Dim txt1 As String = "Today's quote of {0} is {1}" Dim txt2 As String = "Yesterday's quote of {0} was {1}" Dim Val As Integer = (Convert.ToInt32(e.CommandArgument) - 5) ' Set the text values of the labels message1.Text = String.Format(txt1, e.CommandName, _ e.CommandArgument) message2.Text = String.Format(txt2, e.CommandName, Val) End Sub </script> <html > <body> <mobile:form id="form1" runat="server"> <p> <mobile:label id="message1" runat="server"> Click the button for quotes </mobile:label> <mobile:label id="message2" runat="server" /> </p> <mobile:command id="CmdA" Format="Link" onItemCommand="cmd_OnItemCommand" CommandArgument="70" CommandName="ca" runat="server" Text="Company A" /> <mobile:command id="CmdB" Format="Link" onItemCommand ="cmd_OnItemCommand" CommandArgument="25" CommandName="cb" runat="server" Text="Company B" /> <mobile:command id="CmdC" Format="Button" OnItemCommand="cmd_OnItemCommand" CommandArgument="110" CommandName="cc" runat="server" Text="Company C" /> </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"> void cmd_OnItemCommand(object sender, CommandEventArgs e) { // Create variables for data string txt1 = "Today's quote of {0} is {1}"; string txt2 = "Yesterday's quote of {0} was {1}"; int val = (Convert.ToInt32(e.CommandArgument) - 5); // Set the text values of the labels message1.Text = String.Format(txt1, e.CommandName, e.CommandArgument); message2.Text = String.Format(txt2, e.CommandName, val); } </script> <html > <body> <mobile:form id="form1" runat="server"> <p> <mobile:label id="message1" runat="server"> Click the button for quotes </mobile:label> <mobile:label id="message2" runat="server" /> </p> <mobile:command id="CmdA" Format="Link" onItemCommand ="cmd_OnItemCommand" CommandArgument="70" CommandName="ca" runat="server" Text="Company A" /> <mobile:command id="CmdB" Format="Link" onItemCommand ="cmd_OnItemCommand" CommandArgument="25" CommandName="cb" runat="server" Text="Company B" /> <mobile:command id="CmdC" Format="Button" OnItemCommand ="cmd_OnItemCommand" CommandArgument="110" CommandName="cc" runat="server" Text= "Company C" /> </mobile:form> </body> </html>

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に収録されているすべての辞書からCommand.ItemCommand イベントを検索する場合は、下記のリンクをクリックしてください。

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