【发布时间】:2015-11-02 11:26:11
【问题描述】:
当模型在后期操作中无效时,我想返回同一页面并显示错误消息以及query string
我的代码在这里
public ActionResult Action1(string Key)
{
// do something
}
[HttpPost]
public ActionResult Action1(Model user)
{
if (ModelState.IsValid)
{
// do some stuff here
}
else
// redirect to same page with query string key and also error message
}
请通过显示错误消息建议我在模型无效时需要添加的行以保持在同一页面中。
【问题讨论】:
标签: c# asp.net-mvc model-view-controller razor query-string