ImageButton.TagKey プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ImageButton.TagKey プロパティの意味・解説 

ImageButton.TagKey プロパティ

ImageButton コントロール対応する HtmlTextWriterTag 値を取得します

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

Protected Overrides ReadOnly
 Property TagKey As HtmlTextWriterTag
Dim value As HtmlTextWriterTag

value = Me.TagKey
protected override HtmlTextWriterTag TagKey { get;
 }
protected:
virtual property HtmlTextWriterTag TagKey {
    HtmlTextWriterTag get () override;
}
/** @property */
protected HtmlTextWriterTag get_TagKey ()
protected override function get
 TagKey () : HtmlTextWriterTag

プロパティ
HtmlTextWriterTag 列挙値。

解説解説

TagKey プロパティは、カスタム クラスImageButton コントロールか派生させる場合に、主に開発者によって使用されます。

TagKey プロパティ使用してImageButton コントロール関連付けられた HtmlTextWriterTag 値を確認します。このプロパティ基本実装オーバーライドし、常に HtmlTextWriterTag.Input返されるようにします。

使用例使用例

カスタムImageButton コントロールTagKey メソッドオーバーライドして、常に Input タグ返されるようにする方法コード例次に示します

メモメモ

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

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>
<HTML>
    <HEAD>
        <title>Custom ImageButton - TagKey - VB.NET Example</title>
        <script runat="server">
            Sub ImageButton1_Command(sender As
 Object, e As CommandEventArgs)
                ' Redirect to the Microsoft home page.
                Response.Redirect("http://www.microsoft.com/")
            End Sub
        </script>
    </HEAD>
    <body>
        <form id="Form1" method="post"
 runat="server">
            <h3>Custom ImageButton - TagKey - VB.NET Example</h3>
            
            <aspSample:CustomImageButtonTagKey id="ImageButton1"
 runat="server" 
             OnCommand="ImageButton1_Command" AlternateText="Microsoft
 Home" 
             ImageUrl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif"
 />

        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br
 />    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomImageButtonTagKey
        Inherits System.Web.UI.WebControls.ImageButton

        Protected Overrides ReadOnly
 Property TagKey() As System.Web.UI.HtmlTextWriterTag
            Get
                ' Specify that only the Input HTML tag can be passed
 to the HtmlTextWriter.
                Return System.Web.UI.HtmlTextWriterTag.Input
            End Get
        End Property
    End Class
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom ImageButton - TagKey - C# Example</title>
    <script runat="server">
      void ImageButton1_Command(Object sender, CommandEventArgs
 e) 
      {
        // Redirect to the Microsoft home page.
        Response.Redirect("http://www.microsoft.com/");
      }
    </script>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom ImageButton - TagKey - C# Example</h3>
            
            <aspSample:CustomImageButtonTagKey 
              id="ImageButton1" 
              runat="server" 
              OnCommand="ImageButton1_Command" 
              AlternateText="Microsoft Home" 
              ImageUrl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif"
 />

        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br />using
 System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomImageButtonTagKey
 : System.Web.UI.WebControls.ImageButton
    {
        protected override System.Web.UI.HtmlTextWriterTag TagKey
        {
            get
            {
            // Specify that only the Input HTML tag can be passed to
 the HtmlTextWriter.
            return System.Web.UI.HtmlTextWriterTag.Input;
            }
        }
    }
}
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom ImageButton - TagKey - VJ# Example</title>
    <script runat="server">
        void ImageButton1_Command(Object sender, CommandEventArgs
 e) 
        {
            // Redirect to the Microsoft home page.
            get_Response().Redirect("http://www.microsoft.com/");
        } //ImageButton1_Command
    </script>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom ImageButton - TagKey - VJ# Example</h3>
            
            <aspSample:CustomImageButtonTagKey 
              id="ImageButton1" 
              runat="server" 
              OnCommand="ImageButton1_Command" 
              AlternateText="Microsoft Home" 
              ImageUrl="http://www.microsoft.com/homepage/gif/bnr-microsoft.gif"
 />

        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br />package
 Samples.AspNet.JSL.Controls; 

public class CustomImageButtonTagKey
    extends System.Web.UI.WebControls.ImageButton
{
    /** @property 
     */
    protected System.Web.UI.HtmlTextWriterTag get_TagKey()
    {
        // Specify that only the Input HTML tag can be passed to the
 
        // HtmlTextWriter.
        return System.Web.UI.HtmlTextWriterTag.Input;
    } //get_TagKey
} //CustomImageButtonTagKey
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

ImageButton.TagKey プロパティのお隣キーワード
検索ランキング

   

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



ImageButton.TagKey プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS