我正在尝试在将id传递给控制器时返回另一个页面。 但是我得到了这个错误:
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
视图\ Error_Summaries \ Details.cshtml
@{Html.RenderAction("FindAllDetails", new { bolnumber = Model.BOL });}
Error_SummariesController.cs
public ActionResult FindRelatedBols(string bolnumber)
{
if (bolnumber == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Error_Summaries error_Summaries = db.Error_Summaries.SingleOrDefault(r => r.BOL == bolnumber);
if (error_Summaries == null)
{
return HttpNotFound();
}
return View("Views/Error_Details/Details");
}
答案 0 :(得分:0)
检查内部异常时,它显示正在查看错误的操作名称。我已经指定FindAllDetails而不是FindRelatedBols。此外,返回路径是错误的。最后,我没有使用正确的方法名称。
public ActionResult FindRelatedBols(string bolnumber)
{
if (bolnumber == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
//var test =
//var qrytest = db.Error_Details.Where(r => r.BOL == bolnumber);
//var details = qrytest.ToList();
var details = db.Error_Details.Where(r => r.BOL == bolnumber).ToList();
if (details == null)
{
return HttpNotFound();
}
return PartialView("~/Views/Error_Details/Index.cshtml", details);
}