This documentation is archived and is not being maintained.

DataBindingHandlerAttribute Class

Specifies a design-time class that performs data binding of controls within a designer. This class cannot be inherited.

For a list of all members of this type, see DataBindingHandlerAttribute Members.


[Visual Basic]
NotInheritable Public Class DataBindingHandlerAttribute
   Inherits Attribute
public sealed class DataBindingHandlerAttribute : Attribute
public __gc __sealed class DataBindingHandlerAttribute : public
class DataBindingHandlerAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


For more information about using attributes, see Extending Metadata Using Attributes.


[Visual Basic] 

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
    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.";



#using <mscorlib.dll>
#using <System.dll>
#using <System.Web.dll>
#using <System.Design.dll>
using namespace System;
using namespace System::Collections;
using namespace System::Web::UI;
using namespace System::Web::UI::Design;
using namespace System::Web::UI::WebControls;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;

public __gc class MyDataBindingHandler : public DataBindingHandler
   void DataBindControl(IDesignerHost* host, Control* control)
      (dynamic_cast<Label*>(control))->Text = S"Added by data binding handler.";

   ToolboxData(S"< {0}:MyLabel runat=server></ {0}:MyLabel>")
public __gc class MyLabel : public Label
      // Insert your code here.

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Web.UI

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

DataBindingHandlerAttribute Members | System.Web.UI Namespace | Attribute