Buttons do not store anything. Buttons initiate HTTP POST request.
Now if you wish those POSTs to hit different controller actions, you need to put them into two diferent forms and specify two different form urls.
<% BeginForm ("/action1"); %>
<input type="submit" value="Action1" />
<% EndForm ();
<% BeginForm ("/action2"); %>
<input type="submit" value="Action2" />
<% EndForm ();
Then you need to map those routes to two different controller actions (in your Global.asax):
routes.MapRoute(
"Action1",
"/action1",
new { controller = "Test", action = "PostAction1" });
routes.MapRoute(
"Action2",
"/action2",
new { controller = "Test", action = "PostAction2" });
And your controller is there waiting for those actions:
public class TestController : Controller
{
[AcceptVerbs (HttpVerbs.Post)]
public ActionResult PostAction1 (FormCollection form)
{
// Do something
return View ();
}
[AcceptVerbs (HttpVerbs.Post)]
public ActionResult PostAction2 (FormCollection form)
{
// Do something
return View ();
}
}
Then you decide yourself whatever you wish to happen on those actions, save data or do something else.