DataBindingHandlerAttribute 생성자

정의

DataBindingHandlerAttribute 클래스의 새 인스턴스를 초기화합니다.

오버로드

DataBindingHandlerAttribute()

매개 변수를 사용하지 않고 DataBindingHandlerAttribute 클래스의 새 인스턴스를 초기화합니다. 이는 매개 변수가 없는 생성자입니다.

DataBindingHandlerAttribute(String)

지정한 형식 이름을 사용하여 DataBindingHandlerAttribute 클래스의 새 인스턴스를 초기화합니다.

DataBindingHandlerAttribute(Type)

지정된 DataBindingHandlerAttribute에 대한 Type 클래스의 새 인스턴스를 초기화합니다.

DataBindingHandlerAttribute()

매개 변수를 사용하지 않고 DataBindingHandlerAttribute 클래스의 새 인스턴스를 초기화합니다. 이는 매개 변수가 없는 생성자입니다.

public:
 DataBindingHandlerAttribute();
public DataBindingHandlerAttribute ();
Public Sub New ()

예제

다음 코드 예제에서는 생성자를 사용합니다 DataBindingHandlerAttribute .

// The following example uses the Default
// DataBindingHandlerAttribute constructor.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;

namespace MyTextCustomControl
{
   [ DataBindingHandlerAttribute() ]
   [AspNetHostingPermission(SecurityAction.Demand, 
      Level=AspNetHostingPermissionLevel.Minimal)]
   public sealed class MyTextBox : TextBox
   {
      protected override void Render(HtmlTextWriter output)
      {
         output.Write("This class uses the DataBindingHandlerAttribute class.");
      }
   }
}
' The following example uses the Default
' DataBindingHandlerAttribute constructor.
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Security.Permissions

Namespace MyTextCustomControl

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

 End Class
End Namespace 'MyTextCustomControl

적용 대상

DataBindingHandlerAttribute(String)

지정한 형식 이름을 사용하여 DataBindingHandlerAttribute 클래스의 새 인스턴스를 초기화합니다.

public:
 DataBindingHandlerAttribute(System::String ^ typeName);
public DataBindingHandlerAttribute (string typeName);
new System.Web.UI.DataBindingHandlerAttribute : string -> System.Web.UI.DataBindingHandlerAttribute
Public Sub New (typeName As String)

매개 변수

typeName
String

데이터 바인딩 처리기 Type의 정규화된 이름입니다.

예제

다음 코드 예제에서는 생성자를 사용 하 여 DataBindingHandlerAttribute 웹 컨트롤에 대 한 사용자 지정 DataBindingHandler 클래스를 지정 합니다.

// 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.
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
 End Class


 Public Class MyDataBindingHandler
   Inherits TextDataBindingHandler
   
   Public Overrides Sub DataBindControl(host As IDesignerHost, myControl As Control)
      CType(myControl, TextBox).Text = "Added by MyDataBindingHandler"
   End Sub
 End Class
End Namespace 'MyTextCustomControl

설명

이 생성자의 형식 이름은 해당 어셈블리 이름을 포함하여 형식의 정규화된 이름입니다.

적용 대상

DataBindingHandlerAttribute(Type)

지정된 DataBindingHandlerAttribute에 대한 Type 클래스의 새 인스턴스를 초기화합니다.

public:
 DataBindingHandlerAttribute(Type ^ type);
public DataBindingHandlerAttribute (Type type);
new System.Web.UI.DataBindingHandlerAttribute : Type -> System.Web.UI.DataBindingHandlerAttribute
Public Sub New (type As Type)

매개 변수

type
Type

데이터 바인딩 처리기의 Type입니다.

예제

다음 코드 예제에서는 편집 모드에서 디자이너에서 사용할 데이터 MyDataBindingHandler바인딩 처리기를 정의합니다. 편집 모드를 종료하면 Text 속성 값이 표시됩니다.


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
{
  [
    DataBindingHandler(typeof(MyDataBindingHandler)),
    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.";
    }
  }
}

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
      
    End Class
   
    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
      
    End Class
    
End Namespace 'CustomControls

설명

이 특성의 구문은 다음과 같습니다.

[DataBindingHandlerAttribute  
  (typeof(dataBindingHandlerType))]  

적용 대상