指定したコントロールでのデータ連結を実行します。
Overrides Public Sub DataBindControl( _
ByVal designerHost As IDesignerHost, _ ByVal control As Control _)
[C#]
public override void DataBindControl(IDesignerHostdesignerHost,Controlcontrol);
[C++]
public: void DataBindControl(IDesignerHost* designerHost,Control* control);
[JScript]
public override function DataBindControl(
designerHost : IDesignerHost,control : Control);
パラメータ
- designerHost
コントロールを含んでいるドキュメントの IDesignerHost 。 - control
データ連結する Control 。
解説
指定したコントロールがそのデータ連結内で指定されたデータ ソースを持つ場合、このメソッドは、データ ソースで使用する空のリストにサンプルのデータ連結テキストを追加します。
使用例
[Visual Basic] DataBindControl メソッドをオーバーライドして、コントロールがデータ連結されている場合に SimpleRadioButtonList
クラスにカスタム文字列を追加するコード例を次に示します。
[Visual Basic] このコード例は、 ListControlDataBindingHandler クラスのトピックで取り上げているコード例の一部分です。
' Override the DataBindControl method.
Public Overrides Sub DataBindControl( _
designerHost As IDesignerHost, _
control As Control)
' Create a reference, named dataSourceBinding,
' to the control's DataSource binding.
Dim dataSourceBinding As DataBinding _
= CType( _
control, _
IDataBindingsAccessor).DataBindings("DataSource")
' If the binding exists, create a reference to the
' list control, clear its ListItemCollection, then add
' an item to the collection.
If Not (dataSourceBinding Is Nothing) Then
Dim simpleControl As SimpleRadioButtonList = _
CType(control, SimpleRadioButtonList)
simpleControl.Items.Clear()
simpleControl.Items.Add("Data-bound Radio Button.")
End If
End Sub
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
ListControlDataBindingHandler クラス | ListControlDataBindingHandler メンバ | System.Web.UI.Design.WebControls 名前空間