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

Command.Click イベント

ユーザーCommand コントロールアクティブにするときに発生します

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

解説解説
使用例使用例

コマンド イベント追加する方法次のコード例示しますCommand ボタンいずれかクリックすると、OnItemCommand イベント発生しますユーザー定義関数は、CommandEventArgs 引数使用してクリックされた Command ボタン確認します

メモメモ

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

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

<script runat="server">
    Public Sub Page_Load(ByVal
 sender As Object, _
        ByVal e As EventArgs)

        Dim caps As System.Web.Mobile.MobileCapabilities
 _
            = CType(Request.Browser, MobileCapabilities)

        If caps.MaximumSoftkeyLabelLength = 5 Then
            Command1.SoftkeyLabel = "Click"
        ElseIf caps.MaximumSoftkeyLabelLength > 5 Then
            Command1.SoftkeyLabel = "Submit"
        End If
    End Sub

    Private Sub Command_Click(ByVal
 sender As Object, _
        ByVal e As CommandEventArgs)

        Dim txt As String
 = "You clicked Button{0}. ({1} points)"
        If e.CommandName.ToString() = "Command1"
 Then
            Label1.Text = String.Format(txt, 1, e.CommandArgument)
        ElseIf e.CommandName.ToString() = "Command2"
 Then
            Label1.Text = String.Format(txt, 2, e.CommandArgument)
        End If
    End Sub
</script>

<html  >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Label id="Label1" runat="server">
            Click a button
        </mobile:Label>
        <mobile:Label id="Label2" runat="server"
 /> 
        <mobile:Command id="Command1" Format="Button"
            OnItemCommand="Command_Click" 
            CommandName="Command1" runat="server"
 
            Text="Button1" CommandArgument="70"
 />
        <mobile:Command id="Command2" Format="Link"
            OnItemCommand="Command_Click" 
            CommandName="Command2" runat="server"
 
            Text="Button2" CommandArgument="50"
 />
    </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" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    public void Page_Load(Object sender, EventArgs
 e)
    {
        MobileCapabilities caps
            = (MobileCapabilities)Request.Browser;
        if (caps.MaximumSoftkeyLabelLength == 5)
        {
            Command1.SoftkeyLabel = "Click";
        }
        else if (caps.MaximumSoftkeyLabelLength
 > 5)
        {
            Command1.SoftkeyLabel = "Submit";
        }
    }

    void Command_Click(object sender, CommandEventArgs e)
    {
        string txt = "You clicked Button{0}. ({1} points)";
        if (e.CommandName.ToString() == "Command1")
        {
            Label1.Text = String.Format(txt, 1, 
                e.CommandArgument);
        }
        else if (e.CommandName.ToString() ==
 "Command2")
        {
            Label1.Text = String.Format(txt, 2, 
                e.CommandArgument);
        }
    }
</script>

<html  >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Label id="Label1" runat="server">
            Click a button
        </mobile:Label>
        <mobile:Label id="Label2" runat="server" /> 
        <mobile:Command id="Command1"  Format="Button"
            OnItemCommand="Command_Click" 
            CommandName="Command1" runat="server" 
            Text="Button1" CommandArgument="70" />
        <mobile:Command id="Command2" Format="Link"
            OnItemCommand="Command_Click" 
            CommandName="Command2" runat="server" 
            Text="Button2" CommandArgument="50" />
    </mobile:form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からCommand.Click イベントを検索した結果を表示しています。
Weblioに収録されているすべての辞書からCommand.Click イベントを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からCommand.Click イベント を検索

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

辞書ショートカット

すべての辞書の索引

「Command.Click イベント」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS