How to get who calls PostBack?

There are many controls on my page, and I want to know who is calling the PostBack page in the Page_Load event.

+4
source share
1 answer

For this you can try

 string ctr = Page.Request.Params.Get("__EVENTTARGET"); 

Here ctr will contain your ID controls.

__EVENTTARGET transfer information that calls the PostBack page

You can also use __EVENTARGUMENT to pass an argument to this control.

 Page.Request.Params.Get("__EVENTARGUMENT") 
+6
source

Source: https://habr.com/ru/post/1412095/


All Articles