HtmlButton コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlButton コンストラクタの意味・解説 

HtmlButton コンストラクタ

HtmlButton クラス新しインスタンス初期化します。

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

public HtmlButton ()
public:
HtmlButton ()
public HtmlButton ()
解説解説
使用例使用例

Web フォーム ページHtmlButton コントロール動的に追加する方法次のコード例示します

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

<html> 

<head>

   <script runat="server">

      Sub Page_Load(sender As Object,
 e As EventArgs)

         ' Create a new HtmlButton control.
         Dim NewButtonControl As New
 HtmlButton()

         ' Set the properties of the new HtmlButton control.
         NewButtonControl.ID = "NewButtonControl"
         NewButtonControl.InnerHtml = "Click Me"

         ' Create an EventHandler delegate for the method you want to
 handle the event
         ' and then add it to the list of methods called when the event
 is raised.
         AddHandler NewButtonControl.ServerClick, AddressOf
 Button_Click 

         ' Add the new HtmlButton control to the Controls collection
 of the
         ' PlaceHolder control. 
         ControlContainer.Controls.Add(NewButtonControl)

      End Sub

      Sub Button_Click(sender As Object,
 e As EventArgs)

         ' Display a simple message. 
         Message.InnerHtml = "Thank you for clicking the button."

      End Sub

   </script>

</head>

<body>

   <form runat="server">

      <h3> HtmlButton Constructor Example </h3>

      <asp:PlaceHolder ID="ControlContainer"
           runat="server"/>

      <br><br>
 
      <span ID="Message"
            runat="server"/>

   </form>

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

<html> 

<head>

   <script runat="server">

      void Page_Load(Object sender, EventArgs e)
      {

         // Create a new HtmlButton control.
         HtmlButton NewButtonControl = new HtmlButton();

         // Set the properties of the new HtmlButton control.
         NewButtonControl.ID = "NewButtonControl";
         NewButtonControl.InnerHtml = "Click Me";

         // Create an EventHandler delegate for the method you want
 to handle the event
         // and then add it to the list of methods called when the event
 is raised.
         NewButtonControl.ServerClick += new System.EventHandler(this.Button_Click);
 

         // Add the new HtmlButton control to the Controls collection
 of the
         // PlaceHolder control. 
         ControlContainer.Controls.Add(NewButtonControl);

      }

      void Button_Click(Object sender, EventArgs e)
      {

         // Display a simple message. 
         Message.InnerHtml = "Thank you for clicking the
 button.";

      }

   </script>

</head>

<body>

   <form runat="server">

      <h3> HtmlButton Constructor Example </h3>

      <asp:PlaceHolder ID="ControlContainer"
           runat="server"/>

      <br><br>
 
      <span ID="Message"
            runat="server"/>

   </form>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「HtmlButton コンストラクタ」の関連用語

HtmlButton コンストラクタのお隣キーワード
検索ランキング

   

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



HtmlButton コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS