Asp – how to check which event caused the post back in asp.net mvc application

asp.netasp.net-mvcbackpost

I have one View and one Controller in my ASP.net MVC Application.

I have one "Submit" button & one "Cancel" button in my view.

When I click any of the botton below action will be triggered.

AcceptVerbs(HttpVerbs.Post)

public ActionResult Result()

{

}

Now the Question is how i will know in my public ActionResult Result() , whether post back caused because of "Submit" or "Cancel" ??

Best Answer

you can try like

function OnBeginRequest(sender, args) {
        var postBackElement = args.get_postBackElement();
if ((postBackElement.id == '<%= btnSave.ClientID %>')
  {

  }
}