次の方法で共有


DataBindingHandlerAttribute コンストラクタ (String)

指定した型名を使用して DataBindingHandlerAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Sub New ( _
    typeName As String _
)
'使用
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
)
適用できません。

パラメータ

  • typeName
    データ バインディング ハンドラ Type の完全修飾名。

解説

このコンストラクタの型名は、アセンブリ名を含む、型の完全修飾名です。

使用例

DataBindingHandlerAttribute コンストラクタを使用して、Web コントロールのカスタム DataBindingHandler クラスを指定するコード例を次に示します。

' 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

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

DataBindingHandlerAttribute クラス
DataBindingHandlerAttribute メンバ
System.Web.UI 名前空間