本文整理匯總了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.";
}
}
}