C# 动态生成的按钮及定义按钮的事件的代码

内容闲暇时间,把内容过程中比较常用的内容备份一下,如下的内容内容是关于C# 动态生成的按钮及定义按钮的事件的内容,应该对码农们也有用途。

HtmlGenericControl control = new HtmlGenericControl("input");
control.Attributes.Add("type", "button");
control.Attributes.Add("onclick",Page.ClientScript.GetPostBackEventReference(this, "btnMyQuery")




写入到界面中2、后台回发拦截与处理


if (Page.IsPostBack)
{
string eventArgument = Page.Request.Form["__EVENTARGUMENT"];
if (!String.IsNullOrEmpty(eventArgument)
&& eventArgument.Equals("btnMyQuery"))
{
}
}




猜你喜欢

转载自www.cnblogs.com/tozgb/p/10694993.html