Determine postback control

/ Published in: ASP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. if (Request.Form["__EVENTTARGET"] == MyControl.ClientID) ...
  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.
  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.
  7. something like
  8. if(sender._postBackSettings.panelID == "UpdatePanel1|LinkButton1")
  9. alert('From LinkButton');
  10. else
  11. alert("Some other control");


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.