Export (0) Print
Expand All

DataBindingHandlerAttribute Constructor (String)

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Show:
© 2015 Microsoft