Reputation: 41
i have the razor view add_event.cshtml:
@model InputEvent
@using (Html.BeginForm("Save", "MyEvent"))
{
inputs
...
...
...
<input type="submit" value="Save" />
}
with the post controller here:
[HttpPost]
public ActionResult Save(InputEvent y)
{
...
...
...
return View()
}
I want to return to a specific URL with return View(). I have tried putting the string in for the url: return View("App/page")
. but the url that i am taken to every time is "/MyEvent/Save". This URL doesnt even exist.
How do get to the view of a specific url?
EDIT: thanks. i had tried that before but i switched the two strings up
Upvotes: 0
Views: 34
Reputation: 18873
Use RedirectToAction()
return RedirectToAction("ActionName","ControllerName");//OR return RedirectToAction("ActionName","ControllerName", routevalue);
Upvotes: 0
Reputation: 1234
You could try redirect if this is an option for you.
return RedirectToAction("SomeView", "Home");
Also passing a model should do. I have
return View("SomeView", someViewModel);
in my code and it works just fine.
Upvotes: 1