Return to Snippet

Revision: 12060
at February 28, 2009 19:39 by spark9


Initial Code
if (Request.Form["__EVENTTARGET"] == MyControl.ClientID) ...

Although this will work for CheckBoxes, DropDownLists, LinkButtons, etc, this does not work for Button controls. This is where the second part comes in. 

You can use the sender._postBackSettings.panelID property to identify the control which raised the click. This will avoid the EndRequestHandler called on any post back.

something like 
if(sender._postBackSettings.panelID == "UpdatePanel1|LinkButton1")
alert('From LinkButton');
else
alert("Some other control");

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

Initial Description

                                

Initial Title
Determine postback control

Initial Tags
ajax

Initial Language
ASP