我得到恢復視圖時出現以下錯誤:無法返回[HttpPost]方法的視圖
Server Error in '/' Application.
--------------------------------------------------------------------------------
The view 'student' or its master was not found. The following locations were searched:
~/Views/Student/student.aspx
~/Views/Student/student.ascx
~/Views/Shared/student.aspx
~/Views/Shared/student.ascx
這裏是我的控制器操作:
[HttpPost]
public ActionResult SubmitStudent()
{
StudentViewModel model = TempData["model"] as StudentResponseViewModel;
ViewData["id"] = model.Id;
ViewData["name"] = model.Name;
string comment = Request["comment"];
var student = student.studentTable.Where(s => s.studentId == model.Id);
return View(student);
}
這是我的看法:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<string>>" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Student</title>
</head>
<body>
<div>
Student name listed below:
</div>
<table>
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item)%>
</td>
</tr>
<% } %>
</table>
</body>
</html>
你居然發佈的內容以'/學生/ SubmitStudent' 。我們錯過了一些東西。 –
請提供您的提交按鈕/鏈接信息。 –
對不起,這裏是: