7
私は2つのコントローラ、SearchController
とDetailsController
を持っています。mvc4で別のコントローラのビューを呼び出す方法
SearchController
には、フォームを含む2つのビューが含まれています。この可能性は
私はSearchController
での私の見解の[HttpPost]
アクションの詳細コントローラのビューにリダイレクトするようにしたいです?
私は2つのコントローラ、SearchController
とDetailsController
を持っています。mvc4で別のコントローラのビューを呼び出す方法
SearchController
には、フォームを含む2つのビューが含まれています。この可能性は
私はSearchController
での私の見解の[HttpPost]
アクションの詳細コントローラのビューにリダイレクトするようにしたいです?
最初のコントローラで何らかの処理を行い、その結果を別のコントローラに送信する場合は、RedirectToActionを試すことができます。
ビュー
using(@Html.BeginForm("firstaction", "search", FormMethod.Post)){
// form stuff
}
コントローラ
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();
}
}
あなたは[RedirectResult](http://msdn.microsoft.com/en-us/library/systemを返すことを意味します。 web.mvc.redirectresult(v = 1010).aspx)? – rene