指定した Type の DataBindingHandlerAttribute クラスの新しいインスタンスを初期化します。
名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Sub New ( _
type As Type _
)
'使用
Dim type As Type
Dim instance As New DataBindingHandlerAttribute(type)
public DataBindingHandlerAttribute (
Type type
)
public:
DataBindingHandlerAttribute (
Type^ type
)
public DataBindingHandlerAttribute (
Type type
)
public function DataBindingHandlerAttribute (
type : Type
)
適用できません。
パラメータ
- type
データ連結ハンドラの Type。
解説
この属性の構文は次のとおりです。
[DataBindingHandlerAttribute
(typeof(dataBindingHandlerType))]
使用例
編集モード時にデザイナが使用する、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 Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
DataBindingHandlerAttribute クラス
DataBindingHandlerAttribute メンバ
System.Web.UI 名前空間