Freigeben über


DataBindingHandlerAttribute-Konstruktor (String)

Initialisiert eine neue Instanz der DataBindingHandlerAttribute-Klasse mit dem angegebenen Typnamen.

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

Syntax

'Declaration
Public Sub New ( _
    typeName As String _
)
'Usage
Dim typeName As String

Dim instance As New DataBindingHandlerAttribute(typeName)
public DataBindingHandlerAttribute (
    string typeName
)
public:
DataBindingHandlerAttribute (
    String^ typeName
)
public DataBindingHandlerAttribute (
    String typeName
)
public function DataBindingHandlerAttribute (
    typeName : String
)

Parameter

  • typeName
    Der vollqualifizierte Name des Datenbindungshandlers Type.

Hinweise

Der Typname dieses Konstruktors ist der vollqualifizierte Name des Typs, einschließlich seines Assemblynamens.

Beispiel

Im folgenden Codebeispiel wird mithilfe des DataBindingHandlerAttribute-Konstruktors eine benutzerdefinierte DataBindingHandler-Klasse für das Websteuerelement festgelegt.

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

Namespace MyTextCustomControl

 <DataBindingHandlerAttribute("MyTextCustomControl.MyDataBindingHandler")>  _
 <AspNetHostingPermission(SecurityAction.Demand, _
   Level:=AspNetHostingPermissionLevel.Minimal)> _
 Public NotInheritable Class MyWebControl
   Inherits WebControl
   
   Protected Overrides Sub Render(output As HtmlTextWriter)
      output.Write("This class uses the DataBindingHandlerAttribute class.")
   End Sub 'Render 
 End Class 'MyWebControl


 Public Class MyDataBindingHandler
   Inherits TextDataBindingHandler
   
   Public Overrides Sub DataBindControl(host As IDesignerHost, myControl As Control)
      CType(myControl, TextBox).Text = "Added by MyDataBindingHandler"
   End Sub 'DataBindControl
 End Class 'MyDataBindingHandler
End Namespace 'MyTextCustomControl
// 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";
      }
   }
}
// The following example uses the 
// DataBindingHandlerAttribute(String) constructor to designate
// the custom DataBindingHandler class, named MyDataBindingHandler,
// for the custom MyWebControl class.

package MyTextCustomControl;

import System.*;
import System.Web.UI.*;
import System.Web.UI.WebControls.*;
import System.Web.UI.Design.*;
import System.ComponentModel.Design.*;

/** @attribute DataBindingHandlerAttribute(
    "MyTextCustomControl.MyDataBindingHandler")
 */
public class MyWebControl extends WebControl
{
    protected void Render(HtmlTextWriter output)
    {
        output.Write("This class uses the DataBindingHandlerAttribute class.");
    } //Render
} //MyWebControl

public class MyDataBindingHandler extends TextDataBindingHandler
{
    public void DataBindControl(IDesignerHost host, Control myControl)
    {
        ((TextBox)myControl).set_Text("Added by MyDataBindingHandler");
    } //DataBindControl
} //MyDataBindingHandler

Plattformen

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

DataBindingHandlerAttribute-Klasse
DataBindingHandlerAttribute-Member
System.Web.UI-Namespace