これは簡単です。(bool に応じて) 新しいビューを返すコントローラーを呼び出すビューがあります。そうでない場合は、現在のビューにとどまります。
どうすればいいですか?
私の現在のコントローラーコードは次のようなものです:
public class MyController : Controller
{
public ActionResult someView(bool myBool) // is really a string
{
if (myBool) // Is really checking if the string is empty
{
ModelState.AddModelError("message", "This is true");
}
else
{
return View();
}
return null;
}
}
mvc4 についてもっと学ぶ必要があることはわかっていますが、一緒に遊んでください ;-D
私のキャプテンスカイホークのために編集 ^^
_Partial ページ コード: ( Thanks to John H )
@using (Html.BeginForm("someView", "My", FormMethod.Get))
{
@Html.TextBox("text")
<input type="submit" value='send' />
}
View
しかし、私の質問の本当の目標は、それを呼び出した元に戻る方法を見つけることです。うまくいけば、Model
あなたがいなくても、それは正しい方法です^^