Cri*_*ios 2 asp.net asp.net-mvc viewusercontrol
控制器如何知道要返回哪些视图?我认为这是通过命名约定,但我已经看到了实例,例如在Nerd Dinner应用程序中,名称不匹配.我在哪里或如何看到这种映射?谢谢.
public class EmployeesController
{
public ViewResult Index()
{
return View("CustomerName");
}
}
Run Code Online (Sandbox Code Playgroud)
将搜索:
Views/Employees/CustomerName.aspx
Views/Employees/CustomerName.ascx
Views/Shared/CustomerName.aspx
Views/Shared/CustomerName.ascx
Run Code Online (Sandbox Code Playgroud)
那几乎就是..
当你刚刚返回View(); 在没有指定名称的情况下,它搜索了与controlleraction同名的视图.在这种情况下,Index.aspx