本文整理汇总了C#中System.Web.UI.IPostBackEventHandler接口的典型用法代码示例。如果您正苦于以下问题:C# IPostBackEventHandler接口的具体用法?C# IPostBackEventHandler怎么用?C# IPostBackEventHandler使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IPostBackEventHandler接口属于System.Web.UI命名空间,在下文中一共展示了IPostBackEventHandler接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClick
//引入命名空间
using System;
using System.Web.UI;
using System.Collections;
using System.Collections.Specialized;
namespace CustomControls {
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
public class MyButton: Control, IPostBackEventHandler {
// Defines the Click event.
public event EventHandler Click;
//Invoke delegates registered with the Click event.
protected virtual void OnClick(EventArgs e) {
if (Click != null) {
Click(this, e);
}
}
// Define the method of IPostBackEventHandler that raises change events.
public void RaisePostBackEvent(string eventArgument){
OnClick(new EventArgs());
}
protected override void Render(HtmlTextWriter output) {
output.Write("<INPUT TYPE = submit name = " + this.UniqueID +
" Value = 'Click Me' />");
}
}
}