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

ConstructorNeedsTagAttribute クラス

サーバー コントロールコンストラクタタグ名が必要であることを指定します

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

<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class
 ConstructorNeedsTagAttribute
    Inherits Attribute
Dim instance As ConstructorNeedsTagAttribute
[AttributeUsageAttribute(AttributeTargets.Class)] 
public sealed class ConstructorNeedsTagAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] 
public ref class ConstructorNeedsTagAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
public final class ConstructorNeedsTagAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class) 
public final class ConstructorNeedsTagAttribute
 extends Attribute
解説解説
使用例使用例
' Attach the ConstructorNeedsTagAttribute to the custom Simple
' class, which is derived from the WebControl class. This 
' instance of the ConstructorNeedsTagAttribute class sets the
' NeedsTag property to true.
<ConstructorNeedsTagAttribute(True)>  _
<AspNetHostingPermission(SecurityAction.Demand, _
  Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class
 Simple
  Inherits WebControl

  Private NameTag As String
 = ""
  
  
  Public Sub New(tag As
 String)
     Me.NameTag = tag
  End Sub 'New
  
  Private UserMessage As String
 = Nothing
  
  ' Create a property named ControlValue.   
  Public Property ControlValue() As
 [String]
     Get
        Return UserMessage
     End Get
     Set
        UserMessage = value
     End Set
  End Property
     
  Protected Overrides Sub
 Render(output As HtmlTextWriter)
     output.Write("Testing the ConstructorNeedsTagAttribute Class.")
  End Sub 'Render
End Class 'Simple
  // Attach the ConstructorNeedsTagAttribute to the custom Simple
  // class, which is derived from the WebControl class. This 
  // instance of the ConstructorNeedsTagAttribute class sets the
  // NeedsTag property to true.
  [ConstructorNeedsTagAttribute(true)]
  [AspNetHostingPermission(SecurityAction.Demand, 
     Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class Simple : WebControl 
  {
     private String NameTag = "";

     public Simple(String tag)
      {
            this.NameTag = tag;
      }         

      private String   UserMessage = null;

      // Create a property named ControlValue.
      public String ControlValue 
      {
         get 
         {
            return UserMessage;
         }
         set 
         {
            UserMessage = value;
         }
      }                



      protected override void Render(HtmlTextWriter
 output) 
      {
         output.Write("Testing the ConstructorNeedsTagAttribute Class.");
      }
}      
// Attach the ConstructorNeedsTagAttribute to the custom Simple
// class, which is derived from the WebControl class. This 
// instance of the ConstructorNeedsTagAttribute class sets the
// NeedsTag property to true.

/** @attribute ConstructorNeedsTagAttribute(true)
 */
public class Simple extends WebControl
{
    private String nameTag = "";

    public Simple(String tag)
    {
        this.nameTag = tag;
    } //Simple

    private String userMessage = null;
    // Create a property named ControlValue.
    /** @property 
     */
    public String get_ControlValue()
    {
        return userMessage;
    } //get_ControlValue
    /** @property 
     */
    public void set_ControlValue(String value)
    {
        userMessage = value;
    } //set_ControlValue

    protected void Render(HtmlTextWriter output)
    {
        output.Write("Testing the ConstructorNeedsTagAttribute Class.");
    } //Render
} //Simple
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.ConstructorNeedsTagAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConstructorNeedsTagAttribute メンバ
System.Web.UI 名前空間
Attribute

ConstructorNeedsTagAttribute コンストラクタ ()

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

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

Dim instance As New ConstructorNeedsTagAttribute
public ConstructorNeedsTagAttribute ()
public:
ConstructorNeedsTagAttribute ()
public ConstructorNeedsTagAttribute ()
public function ConstructorNeedsTagAttribute
 ()
使用例使用例
' Attach the ConstructorNeedsTagAttribute to the custom
' SimpleControl, which is derived from WebControl. When
' this version of the constructor is used, the NeedsTag
' property is automatically set to false; therefore,
' this class does not need a tag attribute.
<ConstructorNeedsTagAttribute()>  _
<AspNetHostingPermission(SecurityAction.Demand, _
   Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class
 SimpleControl
   Inherits WebControl
   
   Private UserMessage As [String] = Nothing
   
   ' Create a property named ControlValue.
   
   Public Property ControlValue() As
 [String]
      Get
         Return UserMessage
      End Get
      Set
         UserMessage = value
      End Set
   End Property
   
   
   Protected Overrides Sub
 Render(output As HtmlTextWriter)
      output.Write("Testing the ConstructorNeedsTagAttribute class.")
   End Sub 'Render 
 End Class 'SimpleControl
 // Attach the ConstructorNeedsTagAttribute to the custom
 // SimpleControl, which is derived from WebControl. When
 // this version of the constructor is used, the NeedsTag
 // property is automatically set to false; therefore,
 // this class does not need a tag attribute.
 [ConstructorNeedsTagAttribute()] 
 [AspNetHostingPermission(SecurityAction.Demand, 
     Level=AspNetHostingPermissionLevel.Minimal)]
 public sealed class SimpleControl : WebControl
 
 {
 
      private String UserMessage=null;
 
      // Create a property named ControlValue.
      public String ControlValue 
      {
         get 
         {
            return UserMessage;
         }
         set 
         {
            UserMessage = value;
         }
       }
             
      protected override void Render(HtmlTextWriter
 output) 
      {
        output.Write("Testing the ConstructorNeedsTagAttribute class.");

     }
}     
// Attach the ConstructorNeedsTagAttribute to the custom
// SimpleControl, which is derived from WebControl. When
// this version of the constructor is used, the NeedsTag
// property is automatically set to false; therefore,
// this class does not need a tag attribute.

/** @attribute ConstructorNeedsTagAttribute()
 */
public class SimpleControl extends WebControl
{
    private String userMessage = null;
    // Create a property named ControlValue.
    /** @property 
     */
    public String get_ControlValue()
    {
        return userMessage;
    } //get_ControlValue

    /** @property 
     */
    public void set_ControlValue(String value)
    {
        userMessage = value;
    } //set_ControlValue

    protected void Render(HtmlTextWriter output)
    {
        output.Write("Testing the ConstructorNeedsTagAttribute class.");
    } //Render
} //SimpleControl
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConstructorNeedsTagAttribute クラス
ConstructorNeedsTagAttribute メンバ
System.Web.UI 名前空間
Attribute

ConstructorNeedsTagAttribute コンストラクタ (Boolean)

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

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

Public Sub New ( _
    needsTag As Boolean _
)
Dim needsTag As Boolean

Dim instance As New ConstructorNeedsTagAttribute(needsTag)
public ConstructorNeedsTagAttribute (
    bool needsTag
)
public:
ConstructorNeedsTagAttribute (
    bool needsTag
)
public ConstructorNeedsTagAttribute (
    boolean needsTag
)
public function ConstructorNeedsTagAttribute
 (
    needsTag : boolean
)

パラメータ

needsTag

タグコントロール追加する場合trueそれ以外場合false

使用例使用例

タグ名が実行時定義される単純なカスタム コントロール作成するコード例次に示します実行可能ファイル作成するために使用されるコマンド ライン次に示します

vbc /r:System.dll /r:System.Web.dll /t:library /out:myWebAppPath/Bin/vb_myconstructorNeedsTagAtt.dll
 constructNeedsTagAtt.vb
csc /t:library /out:myWebAppPath/Bin/cs_myConstructorNeedsTagAtt.dll constructorNeedsTagAtt.cs
' File name: constructorneedstagatt.cs. 

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


Namespace MyUserControl
   <ConstructorNeedsTagAttribute(True)>  _
   Public Class Simple
      Inherits WebControl
      Private NameTag As [String] = ""
      
      Public Sub New(tag
 As [String])
        Me.NameTag = tag
      End Sub 'New
      
      <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="FullTrust")> _
      Protected Overrides Sub
 Render(output As HtmlTextWriter)
        output.Write(("<br>The TagName used for the
 'Simple' control is " + "'" + NameTag + "'"))
      End Sub 'Render
   End Class 'Simple
End Namespace 'MyUserControl
/* File Name: constructorneedstagatt.cs. */

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

namespace MyUserControl 
{
  // Attach the 'ConstructorNeedsTagAttribute' to 'Simple' class. 
  [ConstructorNeedsTagAttribute(true)]
  public class Simple : WebControl 
  {
    private String NameTag = "";

    public Simple(String tag)
    {
      this.NameTag = tag;
    } 
 
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="FullTrust")]
    protected override void Render(HtmlTextWriter
 output) 
    {
      output.Write("<br>The TagName used for the 'Simple'
 control is "+"'"+NameTag+"'");
    }
  }  
}
package MyUserControl;
/* File Name: constructorneedstagatt.jsl. */

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

// Attach the 'ConstructorNeedsTagAttribute' to 'Simple' class. 
/** @attribute ConstructorNeedsTagAttribute(true)
 */
public class Simple extends WebControl
{
    private String nameTag = "";

    public Simple(String tag)
    {
        this.nameTag = tag;
    } //Simple

    protected void Render(HtmlTextWriter output)
    {
        output.Write("<br>The TagName used for the
 'Simple' control is "
            + "'" + nameTag + "'");
    } //Render
} //Simple

前述カスタム コントロール使用するコード例次に示しますRegister ディレクティブ示される値には、前のコマンド ライン反映されます。

<%@ Register TagPrefix='MyCurrentUserControl' Namespace='MyUserControl'
 Assembly='vb_myConstructorNeedsTagAtt'%>
 <html>
  <body>
  <form method="POST" runat="server">
  <MyCurrentUserControl:Simple runat="server" />
  </form>
  </body>
 </html>
<%@ Register TagPrefix='MyCurrentUserControl' Namespace='MyUserControl' Assembly='cs_myConstructorNeedsTagAtt'%>
 <html>
  <body>
  <form method="POST" runat="server">
  <MyCurrentUserControl:Simple runat="server" />
  </form>
  </body>
 </html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConstructorNeedsTagAttribute クラス
ConstructorNeedsTagAttribute メンバ
System.Web.UI 名前空間

ConstructorNeedsTagAttribute コンストラクタ

ConstructorNeedsTagAttribute クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
ConstructorNeedsTagAttribute () ConstructorNeedsTagAttribute クラス新しインスタンス初期化します。
ConstructorNeedsTagAttribute (Boolean) ConstructorNeedsTagAttribute クラス新しインスタンス初期化します。
参照参照

関連項目

ConstructorNeedsTagAttribute クラス
ConstructorNeedsTagAttribute メンバ
System.Web.UI 名前空間
Attribute

ConstructorNeedsTagAttribute プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

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

ConstructorNeedsTagAttribute メソッド


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

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

関連項目

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

ConstructorNeedsTagAttribute メンバ

サーバー コントロールコンストラクタタグ名が必要であることを指定します

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


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

関連項目

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


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

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

辞書ショートカット

すべての辞書の索引

「ConstructorNeedsTagAttribute」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS