protected void Page_Load(object sender, EventArgs e)
{
Control control = GetPostBackControl(this);
//if (null != control)
//{
// string controlName = control.ClientID;
//}
}
private Control GetPostBackControl(Page page)
{
Control control = null;
string postBackControlName = Request.Params.Get("__EVENTTARGET");
string eventArgument = Request.Params.Get("__EVENTARGUMENT");
if (postBackControlName != null && postBackControlName.Length > 0)
{
control = Page.FindControl(postBackControlName);
}
else
{
foreach (string str in Request.Form)
{
Control c = Page.FindControl(str);
if (c is Button)
{
control = c;
break;
}
}
}
return control;
}