本文整理汇总了C#中System.Web.UI.DataBindingHandlerAttribute.DataBindingHandlerAttribute构造函数的典型用法代码示例。如果您正苦于以下问题:C# DataBindingHandlerAttribute构造函数的具体用法?C# DataBindingHandlerAttribute怎么用?C# DataBindingHandlerAttribute使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Web.UI.DataBindingHandlerAttribute
的用法示例。
在下文中一共展示了DataBindingHandlerAttribute构造函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.");
}
}
}
示例2: DataBindingHandlerAttribute
// 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";
}
}
}
示例3: MyLabel
//引入命名空间
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.";
}
}
}