There are times in asp.net when I really want to know which control in the page raised caused the page to post back. An easy way to find this is to register an event with the control that raises PostBack and cast the sender property to the appropriate control as shown below.
As shown in the above code I am casting the sender property to the appropriate control to find out which control raised the PostBack. Although finding which control raised the event from the click event handler is nice, but sometimes that is too late in the page life cycle. In a scenario where you have to create controls dynamically, you cannot create controls no later than page load event . In this case, it becomes mandatory for you to know which control raised the PostBack and depending on the situation you may decide to perform certain action. The code shown below shows you how to find which control raised PostBack in page load or earlier events.
Read more: Zeeshan Hirani