TagPrefixAttributeとは? わかりやすく解説

TagPrefixAttribute クラス

カスタム コントロール識別するために、Web ページ使用されるタグ プリフィックス定義します。このクラス継承できません。

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

<AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple:=True)> _
Public NotInheritable Class
 TagPrefixAttribute
    Inherits Attribute
Dim instance As TagPrefixAttribute
[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true)]
 
public sealed class TagPrefixAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple=true)]
 
public ref class TagPrefixAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true)
 */ 
public final class TagPrefixAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true)
 
public final class TagPrefixAttribute extends
 Attribute
解説解説
使用例使用例
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

<assembly: TagPrefix("CustomControls", "custom")>
 _

Namespace CustomControls
   
   ' Simple custom control
   Public Class MyVB_Control 
   Inherits Control
      Private message As String
 = "Hello"
      
      Public  Property getMessage() As
 String
         Get
            Return message
         End Get
         Set (ByVal value As
 String)
            message = value
         End Set
      End Property
      
      <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
      Protected Overrides Sub
 Render(writer As HtmlTextWriter)
         writer.Write(("<span style='background-color:aqua;
 font:8pt tahoma, verdana;'> " + Me.getMessage + "<br>"
 + "VB version. The time on the server is " + System.DateTime.Now.ToLongTimeString() + "</span>"))
      End Sub 'Render
   End Class 'MyControl
End Namespace 'CustomControls
 

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

[assembly:TagPrefix("CustomControls", "custom")]


namespace CustomControls
{

    // Simple custom control
    public class MyCS_Control : Control
      {
            private String message = "Hello";
            
            public virtual String Message
            {
                  get
                  {
                        return message;
                  }
                  set
                  {
                        message = value;
                  }
            }
            
            [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")] 
            protected override void Render(
 HtmlTextWriter writer)
            {
            writer.Write("<span style='background-color:aqua; font:8pt tahoma,
 verdana;'> "
                        + this.Message + "<br>"
 + "C# version. The time on the server is " + System.DateTime.Now.ToLongTimeString()
                        + "</span>");
                  
            }
      
      }

}

import System.*;
import System.Web.*;
import System.Web.UI.*;
import System.Web.UI.WebControls.*;

/** @assembly TagPrefix("CustomControls", "custom")
 */
// Simple custom control
public class MyJSL_Control extends Control
{
    private String message = "Hello";

    /** @property 
     */
    public String get_Message()
    {
        return message;
    } //get_Message

    /** @property 
     */
    public void set_Message(String value)
    {
        message = value;
    } //set_Message

    protected void Render(HtmlTextWriter writer)
    {
        writer.Write("<span style='background-color:aqua; font:8pt"
            + " tahoma, verdana;'> " + this.get_Message()
 + "<br>"
            + "VJ# version. The time on the server is "
            + System.DateTime.get_Now().ToLongTimeString() + "</span>");
    } //Render
} //MyJSL_Control
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.TagPrefixAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

TagPrefixAttribute コンストラクタ

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

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

Public Sub New ( _
    namespaceName As String, _
    tagPrefix As String _
)
Dim namespaceName As String
Dim tagPrefix As String

Dim instance As New TagPrefixAttribute(namespaceName,
 tagPrefix)
public TagPrefixAttribute (
    string namespaceName,
    string tagPrefix
)
public:
TagPrefixAttribute (
    String^ namespaceName, 
    String^ tagPrefix
)
public TagPrefixAttribute (
    String namespaceName, 
    String tagPrefix
)
public function TagPrefixAttribute (
    namespaceName : String, 
    tagPrefix : String
)

パラメータ

namespaceName

カスタム コントロール名前空間識別する文字列

tagPrefix

カスタム コントロールプリフィックス識別する文字列

例外例外
例外種類条件

ArgumentNullException

namespaceName または tagPrefix が、null 参照 (Visual Basic では Nothing) または空の文字列 ("") です。

解説解説
使用例使用例

コントロール開発者カスタム コントロールタグ プリフィックス エイリアス指定するために使用できるアセンブリ レベル属性定義する方法次のコード例示します。この属性は、カスタム コントロール使用される Web ページRegister ディレクティブ自動的に生成するために、Microsoft Visual Studio などのツール使用されます。

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

<assembly: TagPrefix("CustomControls", "custom")>
 _

Namespace CustomControls
   
   ' Simple custom control
   Public Class MyVB_Control 
   Inherits Control
      Private message As String
 = "Hello"
      
      Public  Property getMessage() As
 String
         Get
            Return message
         End Get
         Set (ByVal value As
 String)
            message = value
         End Set
      End Property
      
      <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
      Protected Overrides Sub
 Render(writer As HtmlTextWriter)
         writer.Write(("<span style='background-color:aqua;
 font:8pt tahoma, verdana;'> " + Me.getMessage + "<br>"
 + "VB version. The time on the server is " + System.DateTime.Now.ToLongTimeString() + "</span>"))
      End Sub 'Render
   End Class 'MyControl
End Namespace 'CustomControls
 

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

[assembly:TagPrefix("CustomControls", "custom")]


namespace CustomControls
{

    // Simple custom control
    public class MyCS_Control : Control
      {
            private String message = "Hello";
            
            public virtual String Message
            {
                  get
                  {
                        return message;
                  }
                  set
                  {
                        message = value;
                  }
            }
            
            [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")] 
            protected override void Render(
 HtmlTextWriter writer)
            {
            writer.Write("<span style='background-color:aqua; font:8pt tahoma,
 verdana;'> "
                        + this.Message + "<br>"
 + "C# version. The time on the server is " + System.DateTime.Now.ToLongTimeString()
                        + "</span>");
                  
            }
      
      }

}

import System.*;
import System.Web.*;
import System.Web.UI.*;
import System.Web.UI.WebControls.*;

/** @assembly TagPrefix("CustomControls", "custom")
 */
// Simple custom control
public class MyJSL_Control extends Control
{
    private String message = "Hello";

    /** @property 
     */
    public String get_Message()
    {
        return message;
    } //get_Message

    /** @property 
     */
    public void set_Message(String value)
    {
        message = value;
    } //set_Message

    protected void Render(HtmlTextWriter writer)
    {
        writer.Write("<span style='background-color:aqua; font:8pt"
            + " tahoma, verdana;'> " + this.get_Message()
 + "<br>"
            + "VJ# version. The time on the server is "
            + System.DateTime.get_Now().ToLongTimeString() + "</span>");
    } //Render
} //MyJSL_Control
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TagPrefixAttribute クラス
TagPrefixAttribute メンバ
System.Web.UI 名前空間

TagPrefixAttribute プロパティ


TagPrefixAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TagPrefixAttribute クラス
System.Web.UI 名前空間
Attribute

その他の技術情報

@ Register
カスタム サーバー コントロール構文

TagPrefixAttribute メンバ

カスタム コントロール識別するために、Web ページ使用されるタグ プリフィックス定義します。このクラス継承できません。

TagPrefixAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド TagPrefixAttribute TagPrefixAttribute クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスハッシュ コード返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TagPrefixAttribute クラス
System.Web.UI 名前空間
Attribute

その他の技術情報

@ Register
カスタム サーバー コントロール構文



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

辞書ショートカット

すべての辞書の索引

「TagPrefixAttribute」の関連用語

TagPrefixAttributeのお隣キーワード
検索ランキング

   

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



TagPrefixAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS