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

TextBox.TagKey プロパティ

テキスト ボックス コントロールHTML タグ取得します。このプロパティ保護されています。

名前空間: 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.Textarea。それ以外場合Input

使用例使用例

Tagkey プロパティ使用してカスタム テキスト ボックス作成する方法次のコード例示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>
<HTML>
    <HEAD>
        <title>Custom TextBox - TagKey - VB.NET Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post"
 runat="server">
            <h3>Custom TextBox - TagKey - VB.NET Example</h3>
            
            <aspSample:CustomTextBoxTagKey 
              id="TextBox1" 
              runat="server">Hello World!
          </aspSample:CustomTextBoxTagKey>
          
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - TagKey - C# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom TextBox - TagKey - C# Example</h3>
            
            <aspSample:CustomTextBoxTagKey 
              id="TextBox1" 
              runat="server">Hello World!
            </aspSample:CustomTextBoxTagKey>
            
        </form>
    </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom TextBox - TagKey - VJ# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom TextBox - TagKey - VJ# Example</h3>
            
            <aspSample:CustomTextBoxTagKey 
              id="TextBox1" 
              runat="server"
              text="Hello World!">
            </aspSample:CustomTextBoxTagKey>
            
        </form>
    </body>
</HTML>
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomTextBoxTagKey
        Inherits System.Web.UI.WebControls.TextBox

        Protected Overrides ReadOnly
 Property TagKey() As System.Web.UI.HtmlTextWriterTag
            Get
                ' If the TextMode is MultiLine, return a Textarea tag,
 else return an Input tag.
                If Me.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine
 Then
                    Return System.Web.UI.HtmlTextWriterTag.Textarea
                Else
                    Return System.Web.UI.HtmlTextWriterTag.Input
                End If
            End Get
        End Property
    End Class
End Namespace
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class CustomTextBoxTagKey :
 System.Web.UI.WebControls.TextBox
  {
    protected override System.Web.UI.HtmlTextWriterTag TagKey
    {
      get 
      {
        // If the TextMode is MultiLine, return a Textarea tag, 
        // else return an Input tag.
        if (this.TextMode == System.Web.UI.WebControls.TextBoxMode.MultiLine)
        {
          return System.Web.UI.HtmlTextWriterTag.Textarea;
        }
        else
        {
          return System.Web.UI.HtmlTextWriterTag.Input;
        }
      }
    }
  }
}
package Samples.AspNet.JSL.Controls; 

public class CustomTextBoxTagKey
    extends System.Web.UI.WebControls.TextBox
{
    /** @property 
     */
    protected System.Web.UI.HtmlTextWriterTag get_TagKey()
    {
        // If the TextMode is MultiLine, return a Textarea tag, 
        // else return an Input tag.
        if (this.get_TextMode().Equals(System.Web.UI.WebControls.
            TextBoxMode.MultiLine)) {
            return System.Web.UI.HtmlTextWriterTag.Textarea;
        }
        else {
            return System.Web.UI.HtmlTextWriterTag.Input;
        }
    } //get_TagKey
} //CustomTextBoxTagKey
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS