【发布时间】:2023-03-16 04:45:01
【问题描述】:
返回视图时出现以下错误:
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>
【问题讨论】:
-
您是否真的在向
/Student/SubmitStudent发布内容。我认为我们错过了一些东西。 -
请提供您的提交按钮/链接信息。
-
对不起,这里是:
-
@mootinator:是的,我们在提交时通过 webformt textarea 向 /Student/SubmitStudent 发布一些内容
标签: asp.net-mvc view controller