TagPrefixAttribute クラス
アセンブリ: System.Web (system.web.dll 内)

<AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple:=True)> _ Public NotInheritable Class TagPrefixAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=true)] public sealed class TagPrefixAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple=true)] public ref class TagPrefixAttribute sealed : public Attribute

TagPrefixAttribute クラスは、カスタム コントロールのタグ プリフィックス エイリアスを指定するために必要なアセンブリ レベルの属性を定義します。この属性は、カスタム コントロールが使用される ASP.NET ページで Register ディレクティブを自動的に生成するために、Microsoft Visual Studio などのツールで使用されます。
このディレクティブは名前空間にタグ プリフィックスを登録します。また、カスタム コントロール コードの実装が常駐するアセンブリを指定します。このディレクティブを適切に使用すると、Web ページのカスタム コントロールを宣言によって使用できます。
属性の使用方法については、「属性を使用したメタデータの拡張」を参照してください。

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.Attribute
System.Web.UI.TagPrefixAttribute


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TagPrefixAttribute コンストラクタ
アセンブリ: System.Web (system.web.dll 内)

Dim namespaceName As String Dim tagPrefix As String Dim instance As New TagPrefixAttribute(namespaceName, tagPrefix)
- namespaceName
- tagPrefix



コントロールの開発者がカスタム コントロールのタグ プリフィックス エイリアスを指定するために使用できるアセンブリ レベルの属性を定義する方法を次のコード例に示します。この属性は、カスタム コントロールが使用される 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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TagPrefixAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | NamespaceName | 指定したコントロールの名前空間プリフィックスを取得します。 |
![]() | TagPrefix | 指定したコントロールのタグ プリフィックスを取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

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 から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

TagPrefixAttribute メンバ
カスタム コントロールを識別するために、Web ページで使用されるタグ プリフィックスを定義します。このクラスは継承できません。
TagPrefixAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | NamespaceName | 指定したコントロールの名前空間プリフィックスを取得します。 |
![]() | TagPrefix | 指定したコントロールのタグ プリフィックスを取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

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

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- TagPrefixAttributeのページへのリンク