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 コンストラクタ ()
アセンブリ: 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Weblioに収録されているすべての辞書からDataBindingHandlerAttribute コンストラクタを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からDataBindingHandlerAttribute コンストラクタを検索
- DataBindingHandlerAttribute コンストラクタのページへのリンク