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

<AttributeUsageAttribute(AttributeTargets.Class)> _ Public NotInheritable Class ControlValuePropertyAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)] public sealed class ControlValuePropertyAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] public ref class ControlValuePropertyAttribute sealed : public Attribute

ControlParameter オブジェクトを定義する場合、通常は ControlID プロパティと PropertyName プロパティの両方を設定することにより、コントロールのプロパティをパラメータにバインドします。PropertyName プロパティが設定されていない場合は、既定のプロパティが使用されます。ControlValuePropertyAttribute 属性をコントロールに適用することで、実行時に ControlParameter オブジェクトのバインド先となる、そのコントロールの既定のプロパティが指定されます。
属性の使用方法については、「属性を使用したメタデータの拡張」を参照してください。
ControlValuePropertyAttribute クラスのインスタンスの初期プロパティ値の一覧については、ControlValuePropertyAttribute コンストラクタのトピックを参照してください。

既定のプロパティと値を指定する 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); } } }


System.Attribute
System.Web.UI.ControlValuePropertyAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

Dim name As String Dim type As Type Dim defaultValue As String Dim instance As New ControlValuePropertyAttribute(name, type, defaultValue)

このコンストラクタを使用して、指定したプロパティ名と既定値で ControlValuePropertyAttribute クラスの新しいインスタンスを作成します。また、このコンストラクタは、既定値を type パラメータで指定されたデータ型に変換しようとします。既定値を変換できない場合、DefaultValue プロパティは設定されません。ControlValuePropertyAttribute クラスのインスタンスの初期プロパティ値を次の表に示します。

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

Dim name As String Dim defaultValue As Object Dim instance As New ControlValuePropertyAttribute(name, defaultValue)

このコンストラクタを使用して、指定したプロパティ名と既定値で ControlValuePropertyAttribute クラスの新しいインスタンスを作成します。ControlValuePropertyAttribute クラスのインスタンスの初期プロパティ値を次の表に示します。

既定のプロパティと値を指定する 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); } } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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


このコンストラクタを使用して、指定したプロパティ名で ControlValuePropertyAttribute クラスの新しいインスタンスを作成します。ControlValuePropertyAttribute クラスのインスタンスの初期プロパティ値を次の表に示します。

既定のプロパティを指定する 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); } } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ControlValuePropertyAttribute コンストラクタ

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

ControlValuePropertyAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | DefaultValue | コントロールの既定のプロパティの既定値を取得します。 |
![]() | Name | コントロールの既定のプロパティを取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

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

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

関連項目
ControlValuePropertyAttribute クラスSystem.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue
ControlValuePropertyAttribute メンバ
実行時に ControlParameter オブジェクトのバインド先となるコントロールの既定のプロパティを指定します。このクラスは継承できません。
ControlValuePropertyAttribute データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | ControlValuePropertyAttribute | オーバーロードされます。 ControlValuePropertyAttribute クラスの新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | DefaultValue | コントロールの既定のプロパティの既定値を取得します。 |
![]() | Name | コントロールの既定のプロパティを取得します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |

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

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

関連項目
ControlValuePropertyAttribute クラスSystem.Web.UI 名前空間
Attribute
ControlParameter
ControlID
PropertyName
Name
DefaultValue
- ControlValuePropertyAttributeのページへのリンク