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

ControlValuePropertyAttribute クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

実行時に ControlParameter オブジェクトのバインド先となるコントロールの既定のプロパティを指定します。このクラスは継承できません。

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

<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class
 ControlValuePropertyAttribute
    Inherits Attribute
Dim instance As ControlValuePropertyAttribute
[AttributeUsageAttribute(AttributeTargets.Class)] 
public sealed class ControlValuePropertyAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] 
public ref class ControlValuePropertyAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
public final class ControlValuePropertyAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class) 
public final class ControlValuePropertyAttribute
 extends Attribute
解説解説
使用例使用例

既定のプロパティと値を指定する ControlValuePropertyAttribute 属性をカスタム コントロールに適用する方法を次のコード例に示します。

Imports System.ComponentModel
Imports System.Web.UI

Namespace Samples.AspNet.VB.Controls

    ' Set ControlValueProperty attribute to specify the default
    ' property of this control that a ControlParameter object 
    ' binds to at run time.
    <DefaultProperty("Text"), ControlValueProperty("Text",
 "DefaultText")> Public Class
 SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl

        Dim _text As String

        <Bindable(True), Category("Appearance"),
 DefaultValue("")> Property
 [Text]() As String
            Get
                Return _text
            End Get

            Set(ByVal Value As
 String)
                _text = Value
            End Set
        End Property

        Protected Overrides Sub
 Render(ByVal output As System.Web.UI.HtmlTextWriter)
            output.Write([Text])
        End Sub

    End Class

End Namespace

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
    // Set ControlValueProperty attribute to specify the default
    // property of this control that a ControlParameter object 
    // binds to at run time.
    [DefaultProperty("Text")]
    [ControlValueProperty("Text", "Default Text")]
    public class SimpleCustomControl : WebControl
    {
        private string text;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
            }
        }

        protected override void Render(HtmlTextWriter
 output)
        {
            output.Write(Text);
        }
    }
}

.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.ControlValuePropertyAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue

ControlValuePropertyAttribute コンストラクタ (String, Type, String)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定したプロパティ名と既定値を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。既定値は指定したデータ型に変換されます。

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

public ControlValuePropertyAttribute (
    string name,
    Type type,
    string defaultValue
)
public:
ControlValuePropertyAttribute (
    String^ name, 
    Type^ type, 
    String^ defaultValue
)
public ControlValuePropertyAttribute (
    String name, 
    Type type, 
    String defaultValue
)
public function ControlValuePropertyAttribute
 (
    name : String, 
    type : Type, 
    defaultValue : String
)

パラメータ

name

コントロールの既定のプロパティ。

type

既定値の変換先となる Type。

defaultValue

既定のプロパティの既定値。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlValuePropertyAttribute クラス
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
Type
Name
DefaultValue

ControlValuePropertyAttribute コンストラクタ (String, Object)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定したプロパティ名と既定値を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。

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

public ControlValuePropertyAttribute (
    string name,
    Object defaultValue
)
public:
ControlValuePropertyAttribute (
    String^ name, 
    Object^ defaultValue
)
public ControlValuePropertyAttribute (
    String name, 
    Object defaultValue
)
public function ControlValuePropertyAttribute
 (
    name : String, 
    defaultValue : Object
)

パラメータ

name

コントロールの既定のプロパティ。

defaultValue

既定のプロパティの既定値。

解説解説
使用例使用例

既定のプロパティと値を指定する ControlValuePropertyAttribute 属性をカスタム コントロールに適用する方法を次のコード例に示します。このコンストラクタは、この属性を表す ControlValuePropertyAttribute オブジェクトを作成するために、ASP.NET によって内部的に呼び出されます。

Imports System.ComponentModel
Imports System.Web.UI

Namespace Samples.AspNet.VB.Controls

    ' Set ControlValueProperty attribute to specify the default
    ' property of this control that a ControlParameter object 
    ' binds to at run time.
    <DefaultProperty("Text"), ControlValueProperty("Text",
 "DefaultText")> Public Class
 SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl

        Dim _text As String

        <Bindable(True), Category("Appearance"),
 DefaultValue("")> Property
 [Text]() As String
            Get
                Return _text
            End Get

            Set(ByVal Value As
 String)
                _text = Value
            End Set
        End Property

        Protected Overrides Sub
 Render(ByVal output As System.Web.UI.HtmlTextWriter)
            output.Write([Text])
        End Sub

    End Class

End Namespace

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
    // Set ControlValueProperty attribute to specify the default
    // property of this control that a ControlParameter object 
    // binds to at run time.
    [DefaultProperty("Text")]
    [ControlValueProperty("Text", "Default Text")]
    public class SimpleCustomControl : WebControl
    {
        private string text;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
            }
        }

        protected override void Render(HtmlTextWriter
 output)
        {
            output.Write(Text);
        }
    }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlValuePropertyAttribute クラス
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
Name
DefaultValue

ControlValuePropertyAttribute コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定したプロパティ名を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。

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

Dim name As String

Dim instance As New ControlValuePropertyAttribute(name)
public ControlValuePropertyAttribute (
    string name
)
public:
ControlValuePropertyAttribute (
    String^ name
)
public ControlValuePropertyAttribute (
    String name
)
public function ControlValuePropertyAttribute
 (
    name : String
)

パラメータ

name

コントロールの既定のプロパティ。

解説解説
使用例使用例

既定のプロパティを指定する ControlValuePropertyAttribute 属性をカスタム コントロールに適用する方法を次のコード例に示します。このコンストラクタは、この属性を表す ControlValuePropertyAttribute オブジェクトを作成するために、ASP.NET によって内部的に呼び出されます。

Imports System.ComponentModel
Imports System.Web.UI

Namespace Samples.AspNet.VB.Controls

    ' Set ControlValueProperty attribute to specify the default
    ' property of this control that a ControlParameter object 
    ' binds to at run time.
    <DefaultProperty("Text"), ControlValueProperty("Text")>
 Public Class SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl

        Dim _text As String

        <Bindable(True), Category("Appearance"),
 DefaultValue("")> Property
 [Text]() As String
            Get
                Return _text
            End Get

            Set(ByVal Value As
 String)
                _text = Value
            End Set
        End Property

        Protected Overrides Sub
 Render(ByVal output As System.Web.UI.HtmlTextWriter)
            output.Write([Text])
        End Sub

    End Class

End Namespace

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
    // Set ControlValueProperty attribute to specify the default
    // property of this control that a ControlParameter object 
    // binds to at run time.
    [DefaultProperty("Text")]
    [ControlValueProperty("Text")]
    public class SimpleCustomControl : WebControl
    {
        private string text;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
            }
        }

        protected override void Render(HtmlTextWriter
 output)
        {
            output.Write(Text);
        }
    }
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ControlValuePropertyAttribute クラス
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
Name

ControlValuePropertyAttribute コンストラクタ

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

名前 説明
ControlValuePropertyAttribute (String) 指定したプロパティ名を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。
ControlValuePropertyAttribute (String, Object) 指定したプロパティ名と既定値を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。
ControlValuePropertyAttribute (String, Type, String) 指定したプロパティ名と既定値を使用して、ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。既定値は指定したデータ型に変換されます。
参照参照

関連項目

ControlValuePropertyAttribute クラス
ControlValuePropertyAttribute メンバ
System.Web.UI 名前空間
Name

ControlValuePropertyAttribute プロパティ


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

参照参照

関連項目

ControlValuePropertyAttribute クラス
System.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue

ControlValuePropertyAttribute メソッド


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

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

関連項目

ControlValuePropertyAttribute クラス
System.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue

ControlValuePropertyAttribute メンバ

実行時に ControlParameter オブジェクトのバインド先となるコントロールの既定のプロパティを指定します。このクラスは継承できません。

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


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

関連項目

ControlValuePropertyAttribute クラス
System.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ControlValuePropertyAttribute」の関連用語

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

   

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



ControlValuePropertyAttributeのページの著作権

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

©2026 GRAS Group, Inc.RSS