Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find out which control triggered postback

I have aspx website in which I have multiple user controls. I want to know which control (button, dropdown, radiobutton) triggered postback from those user controls. How I can do that. Thanks in advance, Laziale

like image 335
Laziale Avatar asked Jan 23 '26 11:01

Laziale


1 Answers

From: http://ryanfarley.com/blog/archive/2005/03/11/1886.aspx

string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if (ctrlname != null && ctrlname != string.Empty)
{
    return this.Page.FindControl(ctrlname);
}
like image 82
Firoz Ansari Avatar answered Jan 26 '26 00:01

Firoz Ansari