Handle multiple button post

razor:

<form action="" method="post">
 <input type="submit" value="Save" name="action:Save" />
 <input type="submit" value="Send" name="action:Send" />
</form>

and controller:

    [HttpPost]
    [MultipleButton(Name = "action", Argument = "Send")]
    public ActionResult Send(MessageModel mm) { ... }

    [HttpPost]
    [MultipleButton(Name = "action", Argument = "Save")]
    public ActionResult Save(MessageModel mm) { ... }
Share the joy
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.