Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="submit" name="submit" value="<val>">
- if(submit == "button1") {
- RedirectToAction("Page1");
- } else {
- RedirectToAction("Page2");
- }
- @using (Html.BeginForm("Test", "Home", FormMethod.Post))
- {
- <input type="submit" value="Go 1" name="go-1" />
- <input type="submit" value="Go 2" name="go-2" />
- }
- [HttpPost]
- public ActionResult Test(FormCollection collection)
- {
- if (collection.AllKeys.Contains("go-1")) return View("Page1");
- if (collection.AllKeys.Contains("go-2")) return View("Page2");
- return View("Index");
- }
- public ActionResult Process()
- {
- // do processing
- // redirect to page 2
- return this.RedirectToAction("Index", "Page2");
- }
- @Html.BeginForm("Process", "Page1", FormMethod.Post)
- {
- <input type="submit" name="button" value="Submit" />
- }
- @Html.ActionLink("Redirect to Page 2", "Process", "Page1")
Add Comment
Please, Sign In to add comment