Posted By

spark9 on 02/28/09


Tagged

ajax


Versions (?)

Determine postback control


 / Published in: ASP
 

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

  1. if (Request.Form["__EVENTTARGET"] == MyControl.ClientID) ...
  2.  
  3. Although this will work for CheckBoxes, DropDownLists, LinkButtons, etc, this does not work for Button controls. This is where the second part comes in.
  4.  
  5. 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.
  6.  
  7. something like
  8. if(sender._postBackSettings.panelID == "UpdatePanel1|LinkButton1")
  9. alert('From LinkButton');
  10. else
  11. alert("Some other control");

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: benedict_kmu on August 18, 2009

Good Snippet

You need to login to post a comment.