DataBindingHandlerAttribute クラス
アセンブリ: System.Web (system.web.dll 内)
構文<AttributeUsageAttribute(AttributeTargets.Class)> _ Public NotInheritable Class DataBindingHandlerAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class)] public sealed class DataBindingHandlerAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] public ref class DataBindingHandlerAttribute sealed : public Attribute
解説
使用例編集モード時にデザイナが使用する、MyDataBindingHandler という名前のデータ バインディング ハンドラを定義するコード例を次に示します。編集モードの終了時に、Text プロパティ値が表示されます。
Namespace CustomControls <DataBindingHandler(GetType(MyDataBindingHandler)), ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>")> _ Public Class MyLabel Inherits Label Public Sub New() 'Insert your code here. End Sub 'New End Class 'MyLabel Public Class MyDataBindingHandler Inherits DataBindingHandler Public Overrides Sub DataBindControl(host As IDesignerHost, control As Control) CType(control, Label).Text = "Added by data binding handler." End Sub 'DataBindControl End Class 'MyDataBindingHandler End Namespace 'CustomControls
using System; using System.Collections; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using System.ComponentModel; using System.ComponentModel.Design; namespace CustomControls { [ DataBindingHandler(typeof(MyDataBindingHandler)), ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>") ] public class MyLabel : Label { public MyLabel() { // Insert your code here. } } public class MyDataBindingHandler : DataBindingHandler { public override void DataBindControl(IDesignerHost host, Control control) { ((Label)control).Text = "Added by data binding handler."; } } }
package CustomControls; import System.*; import System.Collections.*; import System.Web.UI.*; import System.Web.UI.Design.*; import System.Web.UI.WebControls.*; import System.ComponentModel.*; import System.ComponentModel.Design.*; /** @attribute DataBindingHandler(MyDataBindingHandler.class) @attribute ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>") */ public class MyLabel extends Label { public MyLabel() { // Insert your code here. } //MyLabel } //MyLabel public class MyDataBindingHandler extends DataBindingHandler { public void DataBindControl(IDesignerHost host, Control control) { ((Label)control).set_Text("Added by data binding handler."); } //DataBindControl } //MyDataBindingHandler
.NET Framework のセキュリティ
継承階層System.Attribute
System.Web.UI.DataBindingHandlerAttribute
スレッド セーフ
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataBindingHandlerAttribute コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)
構文
使用例DataBindingHandlerAttribute コンストラクタを使用するコード例を次に示します。
' The following example uses the Default ' DataBindingHandlerAttribute constructor. Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Security.Permissions Namespace MyTextCustomControl <DataBindingHandlerAttribute()> _ <AspNetHostingPermission(SecurityAction.Demand, _ Level:=AspNetHostingPermissionLevel.Minimal)> _ Public NotInheritable Class MyTextBox Inherits TextBox Protected Overrides Sub Render(output As HtmlTextWriter) output.Write("This class uses the DataBindingHandlerAttribute class.") End Sub 'Render End Class 'MyTextBox End Namespace 'MyTextCustomControl
// The following example uses the Default // DataBindingHandlerAttribute constructor. using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Security.Permissions; namespace MyTextCustomControl { [ DataBindingHandlerAttribute() ] [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class MyTextBox : TextBox { protected override void Render(HtmlTextWriter output) { output.Write("This class uses the DataBindingHandlerAttribute class."); } } }
// The following example uses the Default // DataBindingHandlerAttribute constructor. package MyTextCustomControl; import System.*; import System.Web.UI.*; import System.Web.UI.WebControls.*; /** @attribute DataBindingHandlerAttribute() */ public class MyTextBox extends TextBox { protected void Render(HtmlTextWriter output) { output.Write("This class uses the DataBindingHandlerAttribute class."); } //Render } //MyTextBox
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataBindingHandlerAttribute コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)
構文
解説
使用例DataBindingHandlerAttribute コンストラクタを使用して、Web コントロールのカスタム DataBindingHandler クラスを指定するコード例を次に示します。
' The following example uses the ' DataBindingHandlerAttribute(String) constructor to designate ' the custom DataBindingHandler class, named MyDataBindingHandler, ' for the custom MyWebControl class. Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.Design Imports System.ComponentModel.Design Imports System.Security.Permissions Namespace MyTextCustomControl <DataBindingHandlerAttribute("MyTextCustomControl.MyDataBindingHandler")> _ <AspNetHostingPermission(SecurityAction.Demand, _ Level:=AspNetHostingPermissionLevel.Minimal)> _ Public NotInheritable Class MyWebControl Inherits WebControl Protected Overrides Sub Render(output As HtmlTextWriter) output.Write("This class uses the DataBindingHandlerAttribute class.") End Sub 'Render End Class 'MyWebControl Public Class MyDataBindingHandler Inherits TextDataBindingHandler Public Overrides Sub DataBindControl(host As IDesignerHost, myControl As Control) CType(myControl, TextBox).Text = "Added by MyDataBindingHandler" End Sub 'DataBindControl End Class 'MyDataBindingHandler End Namespace 'MyTextCustomControl
// The following example uses the // DataBindingHandlerAttribute(String) constructor to designate // the custom DataBindingHandler class, named MyDataBindingHandler, // for the custom MyWebControl class. using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.Design; using System.ComponentModel.Design; using System.Security.Permissions; namespace MyTextCustomControl { [ DataBindingHandlerAttribute("MyTextCustomControl.MyDataBindingHandler") ] [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class MyWebControl : WebControl { protected override void Render(HtmlTextWriter output) { output.Write("This class uses the DataBindingHandlerAttribute class."); } } public class MyDataBindingHandler : TextDataBindingHandler { public override void DataBindControl(IDesignerHost host, Control myControl) { ((TextBox)myControl).Text = "Added by MyDataBindingHandler"; } } }
// The following example uses the // DataBindingHandlerAttribute(String) constructor to designate // the custom DataBindingHandler class, named MyDataBindingHandler, // for the custom MyWebControl class. package MyTextCustomControl; import System.*; import System.Web.UI.*; import System.Web.UI.WebControls.*; import System.Web.UI.Design.*; import System.ComponentModel.Design.*; /** @attribute DataBindingHandlerAttribute( "MyTextCustomControl.MyDataBindingHandler") */ public class MyWebControl extends WebControl { protected void Render(HtmlTextWriter output) { output.Write("This class uses the DataBindingHandlerAttribute class."); } //Render } //MyWebControl public class MyDataBindingHandler extends TextDataBindingHandler { public void DataBindControl(IDesignerHost host, Control myControl) { ((TextBox)myControl).set_Text("Added by MyDataBindingHandler"); } //DataBindControl } //MyDataBindingHandler
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataBindingHandlerAttribute コンストラクタ (Type)
アセンブリ: System.Web (system.web.dll 内)
構文
解説
使用例編集モード時にデザイナが使用する、MyDataBindingHandler という名前のデータ バインディング ハンドラを定義するコード例を次に示します。編集モードの終了時に、Text プロパティ値が表示されます。
Namespace CustomControls <DataBindingHandler(GetType(MyDataBindingHandler)), ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>")> _ Public Class MyLabel Inherits Label Public Sub New() 'Insert your code here. End Sub 'New End Class 'MyLabel Public Class MyDataBindingHandler Inherits DataBindingHandler Public Overrides Sub DataBindControl(host As IDesignerHost, control As Control) CType(control, Label).Text = "Added by data binding handler." End Sub 'DataBindControl End Class 'MyDataBindingHandler End Namespace 'CustomControls
using System; using System.Collections; using System.Web.UI; using System.Web.UI.Design; using System.Web.UI.WebControls; using System.ComponentModel; using System.ComponentModel.Design; namespace CustomControls { [ DataBindingHandler(typeof(MyDataBindingHandler)), ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>") ] public class MyLabel : Label { public MyLabel() { // Insert your code here. } } public class MyDataBindingHandler : DataBindingHandler { public override void DataBindControl(IDesignerHost host, Control control) { ((Label)control).Text = "Added by data binding handler."; } } }
package CustomControls; import System.*; import System.Collections.*; import System.Web.UI.*; import System.Web.UI.Design.*; import System.Web.UI.WebControls.*; import System.ComponentModel.*; import System.ComponentModel.Design.*; /** @attribute DataBindingHandler(MyDataBindingHandler.class) @attribute ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>") */ public class MyLabel extends Label { public MyLabel() { // Insert your code here. } //MyLabel } //MyLabel public class MyDataBindingHandler extends DataBindingHandler { public void DataBindControl(IDesignerHost host, Control control) { ((Label)control).set_Text("Added by data binding handler."); } //DataBindControl } //MyDataBindingHandler
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照DataBindingHandlerAttribute コンストラクタ
オーバーロードの一覧| 名前 | 説明 |
|---|---|
| DataBindingHandlerAttribute () | パラメータを使用せずに DataBindingHandlerAttribute クラスの新しいインスタンスを初期化します。これは、既定のコンストラクタです。 |
| DataBindingHandlerAttribute (String) | 指定した型名を使用して DataBindingHandlerAttribute クラスの新しいインスタンスを初期化します。 |
| DataBindingHandlerAttribute (Type) | 指定した Type の DataBindingHandlerAttribute クラスの新しいインスタンスを初期化します。 |
参照DataBindingHandlerAttribute フィールド
DataBindingHandlerAttribute プロパティ
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| HandlerTypeName | データ バインディング ハンドラの型名を取得します。 |
| TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
参照DataBindingHandlerAttribute メソッド
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| 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 から継承されます。) |
参照DataBindingHandlerAttribute メンバ
デザイナ内でコントロールのデータ連結を実行するデザイン時クラスを指定します。このクラスは継承できません。
DataBindingHandlerAttribute データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック フィールド
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| HandlerTypeName | データ バインディング ハンドラの型名を取得します。 |
| 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 から継承されます。) |
参照- DataBindingHandlerAttributeのページへのリンク