Guest User

Untitled

a guest
Jul 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <input type="submit" name="submit" value="<val>">
  2.  
  3. if(submit == "button1") {
  4. RedirectToAction("Page1");
  5. } else {
  6. RedirectToAction("Page2");
  7. }
  8.  
  9. @using (Html.BeginForm("Test", "Home", FormMethod.Post))
  10. {
  11.  
  12. <input type="submit" value="Go 1" name="go-1" />
  13. <input type="submit" value="Go 2" name="go-2" />
  14. }
  15.  
  16. [HttpPost]
  17. public ActionResult Test(FormCollection collection)
  18. {
  19. if (collection.AllKeys.Contains("go-1")) return View("Page1");
  20. if (collection.AllKeys.Contains("go-2")) return View("Page2");
  21. return View("Index");
  22. }
  23.  
  24. public ActionResult Process()
  25. {
  26. // do processing
  27.  
  28. // redirect to page 2
  29. return this.RedirectToAction("Index", "Page2");
  30. }
  31.  
  32. @Html.BeginForm("Process", "Page1", FormMethod.Post)
  33. {
  34. <input type="submit" name="button" value="Submit" />
  35. }
  36.  
  37. @Html.ActionLink("Redirect to Page 2", "Process", "Page1")
Add Comment
Please, Sign In to add comment