【发布时间】:2012-11-06 12:02:08
【问题描述】:
无法在回发中捕获 Imagebuttonclick 事件。
我正在使用以下代码进行按钮单击并尝试使用 Imagebutton,但是“Button”单击其工作而不是 Image 按钮。
public Control GetPostBackControl(Page page)
{
Control control = null;
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if ((ctrlname != null) & ctrlname != string.Empty)
{
control = page.FindControl(ctrlname);
}
else
{
foreach (string ctl in page.Request.Form)
{
Control c = page.FindControl(ctl);
if (c is System.Web.UI.WebControls.Button)
{
control = c;
break;
}
}
}
return control;
}
有什么办法吗?
【问题讨论】:
标签: asp.net