LinkButton.OnCommand メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > LinkButton.OnCommand メソッドの意味・解説 

LinkButton.OnCommand メソッド

LinkButton コントロールCommand イベント発生させます

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

Protected Overridable Sub
 OnCommand ( _
    e As CommandEventArgs _
)
Dim e As CommandEventArgs

Me.OnCommand(e)
protected virtual void OnCommand (
    CommandEventArgs e
)
protected:
virtual void OnCommand (
    CommandEventArgs^ e
)
protected void OnCommand (
    CommandEventArgs e
)
protected function OnCommand (
    e : CommandEventArgs
)

パラメータ

e

イベント データ格納している CommandEventArgs。

解説解説
使用例使用例

Command イベントハンドラ指定およびコーディングして、どの LinkButton コントロールクリックされたかを表示する方法次の例に示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<html>
<head>

   <script language="VB" runat="server">
     
      Sub LinkButton_Command(sender As Object,
 e As CommandEventArgs) 
         Label1.Text = "You chose: " & e.CommandName
 & " Item " & _
            e.CommandArgument
      End Sub
 
   </script>
 
</head>
<body>
 
   <form runat=server>
 
      <h3>LinkButton Command Event Example</h3>
  
      <asp:LinkButton id="LinkButton1" 
           Text="Order Item 10001"
           CommandName="Order" 
           CommandArgument="10001" 
           OnCommand="LinkButton_Command" 
           runat="server"/>
 
      <br>
  
      <asp:LinkButton id="LinkButton2" 
           Text="Order Item 10002"
           CommandName="Order" 
           CommandArgument="10002" 
           OnCommand="LinkButton_Command" 
           Runat="server"/>
 
      <br>
      <p>
 
      <asp:Label id="Label1" runat="server"/>
 
   </form>

</body>
</html>

<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

   <script language="C#" runat="server">
     
      void LinkButton_Command(Object sender, CommandEventArgs
 e) 
      {
         Label1.Text = "You chose: " + e.CommandName + " Item "
 + e.CommandArgument;
      }
 
   </script>
 
</head>
<body>
 
   <form runat=server>
 
      <h3>LinkButton Command Event Example</h3>
  
      <asp:LinkButton id="LinkButton1" 
           Text="Order Item 10001"
           CommandName="Order" 
           CommandArgument="10001" 
           OnCommand="LinkButton_Command" 
           runat="server"/>
 
      <br>
  
      <asp:LinkButton id="LinkButton2" 
           Text="Order Item 10002"
           CommandName="Order" 
           CommandArgument="10002" 
           OnCommand="LinkButton_Command" 
           Runat="server"/>
 
      <br>
      <p>
 
      <asp:Label id="Label1" runat="server"/>
 
   </form>

</body>
</html>

<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
<head>

   <script language="JSCRIPT" runat="server">
     
      function LinkButton_Command(sender : Object, e : CommandEventArgs){
         Label1.Text = "You chose: " + e.CommandName + " Item "
 + e.CommandArgument
      }
 
   </script>
 
</head>
<body>
 
   <form runat=server>
 
      <h3>LinkButton Command Event Example</h3>
  
      <asp:LinkButton id="LinkButton1" 
           Text="Order Item 10001"
           CommandName="Order" 
           CommandArgument="10001" 
           OnCommand="LinkButton_Command" 
           runat="server"/>
 
      <br>
  
      <asp:LinkButton id="LinkButton2" 
           Text="Order Item 10002"
           CommandName="Order" 
           CommandArgument="10002" 
           OnCommand="LinkButton_Command" 
           Runat="server"/>
 
      <br>
      <p>
 
      <asp:Label id="Label1" runat="server"/>
 
   </form>

</body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

LinkButton.OnCommand メソッドのお隣キーワード
検索ランキング

   

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



LinkButton.OnCommand メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS