【发布时间】:2016-08-17 08:34:57
【问题描述】:
`首先,这是我的第一个 MVC 代码 & 我试图在这个站点中搜索问题的解决方案 & 我检查了所有可能的情况,如 routeconfig 文件、控制器、动作属性 & 我试图在指定的值中放置适当的值项目属性的 Web 选项卡页面。但它仍然显示相同的错误。请帮忙。
这里是我的路由配置文件
namespace Deepak_MVC_2
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Student", action = "GetStudents", id = UrlParameter.Optional }
);
}
}
}
特定页面条目:Student/GetStudents
namespace Deepak_MVC_2.Controllers
{
public class StudentController : Controller
{
public ActionResult GetAllStudent()
{
StudentModelManager smm = new StudentModelManager();
List<StudentModel> lsm = smm.GetAllStudentInfo();
ActionResult ar = View("GetStudents",lsm);
return ar;
}
}
}
【问题讨论】:
-
能否请您宣传一下您的控制器代码?
-
StudentController中有GetStudents的动作方法吗? -
不,操作方法是GetAllStudent()。你现在可以看到,因为我已经更新了它。视图名称是 GetStudents.cshtml。
标签: c# asp.net-mvc asp.net-mvc-4 asp.net-mvc-routing