Cybercrux

Everything is achievable through technology

Postback Event Name

Find which control is triggered for the page post back?


///

/// Retrieves the control that caused the postback.
///

///
///
private Control GetControlThatCausedPostBack(Page page)
{
//initialize a control and set it to null
Control ctrl = null;

//get the event target name and find the control
string ctrlName = page.Request.Params.Get("__EVENTTARGET");
if (!String.IsNullOrEmpty(ctrlName))
ctrl = page.FindControl(ctrlName);

//return the control to the calling method
return ctrl;
}

Leave a comment