New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Determine PostBack Control or AJAX Request Initiator
Description
In some scenarios it might prove helpful to know which control has caused the PostBack or partial request action to the server.
Solution
You can use one of these approaches to achieve this requirement.
C#
protected void Page_Load(object sender, EventArgs e)
{
string id1 = Request.Params["__EVENTTARGET"];
string id2 = Request.Form["__EVENTTARGET"];
string id3 = ScriptManager.GetCurrent(Page).AsyncPostBackSourceElementID;
bool isAJAX = ScriptManager.GetCurrent(Page).IsInAsyncPostBack;
if (isAJAX)
{
string id4 = DeterminePostBackMode()["__EVENTTARGET"];
}
}