DataBindingHandlerAttribute Constructor (Type)

 

Initializes a new instance of the DataBindingHandlerAttribute class of the specified Type.

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

Public Sub New (
	type As Type
)

Parameters

type
Type: System.Type

The Type for the data-binding handler.

The syntax for this attribute is:

[DataBindingHandlerAttribute
  (typeof(dataBindingHandlerType))]

The following code example defines a data-binding handler, named MyDataBindingHandler, to be used by the designer in editing mode. On exiting the editing mode, the Text property value is displayed.


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 'NewNew

    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 

.NET Framework
Available since 1.1
Return to top
Show: