I have 2 controllers, SearchController
and DetailsController
.
the SearchController
contains 2 views which contain form.
I want to redirect to a view of the details controller on the [HttpPost]
action of my view in the SearchController
Is this possible???
You could try RedirectToAction if you are doing some processing in the first controller and then sending the result to another controller.
View
using(@Html.BeginForm("firstaction", "search", FormMethod.Post)){
// form stuff
}
Controller
public class SearchController
{
[HttpPost]
public ActionResult FirstAction()
{
// do initial processing in the first controller
// e.g persisting changed on Edit Screen
return RedirectToAction("SecondAction","Details");
}
}
public class DetailsController
{
public ActionResult SecondAction()
{
// do remaining processing in the first controller
// fetching data for a grid and displaying the grid of items
return View();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With