Views 的使用
Useful Resources
VIEW與Controller之間的傳值技巧
public ActionResult Index(Login model, string command)
{
if (command=="Login")
{
// do stuff
return RedirectToAction("Home");
}
else if (command=="Register")
{
// do stuff
ViewBag.msg = "You have Clicked Register button";
return View();
}
else if (command=="Cancel")
{
// do stuff
ViewBag.msg = "You have Clicked Cancel Button";
return View();
}
else
{
return View();
}
}
//View
<input type="submit" id="Login" value="Login" name="Command" title="Login" />
<input type="submit" id="Register" value="Register" name="Command" title="Register" />
<input type="submit" value="Cancel" name="Command" title="Cancel" />
http://www.c-sharpcorner.com/UploadFile/939b56/handling-multiple-submit-buttons-on-the-same-form-in-Asp-Net/