This documentation is archived and is not being maintained.
Control.DataBinding Event
.NET Framework 1.1
Occurs when the server control binds to a data source.
[Visual Basic] Public Event DataBinding As EventHandler [C#] public event EventHandler DataBinding; [C++] public: __event EventHandler* DataBinding;
[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.
Event Data
The event handler receives an argument of type EventArgs.
Remarks
This event notifies the server control to perform any data binding logic that has been written for it.
Example
[Visual Basic] ' 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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Control Class | Control Members | System.Web.UI Namespace | OnDataBinding | Control Execution Lifecycle
Show: