DataBindingHandlerAttribute Constructor (String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the DataBindingHandlerAttribute class with the specified type name.

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

public DataBindingHandlerAttribute(
	string typeName
)

Parameters

typeName
Type: System.String

The fully qualified name of the data-binding handler Type.

The type name for this constructor is the fully qualified name of the type, including its assembly name.

The following code example uses the DataBindingHandlerAttribute constructor to designate a custom DataBindingHandler class for the Web control.

// The following example uses the 
// DataBindingHandlerAttribute(String) constructor to designate
// the custom DataBindingHandler class, named MyDataBindingHandler,
// for the custom MyWebControl class.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Design;
using System.ComponentModel.Design;
using System.Security.Permissions;

namespace MyTextCustomControl
{
   [ DataBindingHandlerAttribute("MyTextCustomControl.MyDataBindingHandler") ]
   [AspNetHostingPermission(SecurityAction.Demand, 
      Level=AspNetHostingPermissionLevel.Minimal)]
   public sealed class MyWebControl : WebControl
   {
      protected override void Render(HtmlTextWriter output)
      {
         output.Write("This class uses the DataBindingHandlerAttribute class.");
      }
   }

   public class MyDataBindingHandler : TextDataBindingHandler
   {
      public override void DataBindControl(IDesignerHost host, Control myControl)
      {
         ((TextBox)myControl).Text = "Added by MyDataBindingHandler";
      }
   }
}

.NET Framework
Available since 1.1
Return to top
Show: