I have 2 buttons and in the page load, and I want to check which button is pressed.
So I used:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if (string.IsNullOrEmpty(Request.Form["__EVENTTARGET"].ToString()))
{
[COMES HERE]
}
else
{
string eTarget = Request.Form["__EVENTTARGET"].ToString();
}
}
else
{
LoadAllData();
}
}
Here, after I press the button, it comes as null
.
How can I know which button is pressed?