次の方法で共有


Control.DataBinding イベント

サーバー コントロールがデータ ソースに連結すると発生します。

Public Event DataBinding As EventHandler
[C#]
public event EventHandler DataBinding;
[C++]
public: __event EventHandler* DataBinding;

[JScript] JScript では、このクラスで定義されているイベントを処理できます。ただし、独自に定義することはできません。

イベント データ

イベント ハンドラが EventArgs 型の引数を受け取りました。

解説

このイベントは、サーバー コントロールのために書き込まれたデータ連結ロジックを実行するように、そのサーバー コントロールに通知します。

使用例

 
' Override the ITemplate.InstantiateIn method to ensure 
' that the templates are created in a Literal control and
' that the Literal object's DataBinding event is associated
' with the BindData method.
Public Sub InstantiateIn(container As Control) Implements ITemplate.InstantiateIn
   Dim l As New Literal()
   AddHandler l.DataBinding, AddressOf Me.BindData
   container.Controls.Add(l)
End Sub 'InstantiateIn


[C#] 
// Override the ITemplate.InstantiateIn method to ensure 
// that the templates are created in a Literal control and
// that the Literal object's DataBinding event is associated
// with the BindData method.
public void InstantiateIn(Control container)
{
    Literal l = new Literal();
    l.DataBinding += new EventHandler(this.BindData);
    container.Controls.Add(l);
}

[C++] 
// Override the ITemplate.InstantiateIn method to ensure
// that the templates are created in a Literal control and
// that the Literal object's DataBinding event is associated
// with the BindData method.
public:
void InstantiateIn(Control* container) {
   Literal* l = new Literal();
   l->DataBinding += new EventHandler(this, &GenericItem::BindData);
   container->Controls->Add(l);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

Control クラス | Control メンバ | System.Web.UI 名前空間 | OnDataBinding | コントロール実行の有効期間