[英]How to determine which ValidationAttribute returned a ModelError
[英]How to determine which view is being returned
我有一个控制器( AccountController.cs
),其Index
方法的最终声明为return View(model);
。
在global.asax中,我只能看到与此相关的路由:
routes.MapRoute("AccountIndex", "Account/Index", new {controller = "Account", action = "Index"});
有一个“视图”文件夹,但它似乎只包含部分视图和一个主视图。 右键单击并选择“转到视图”时,尽管似乎在所有控制器方法上都执行此操作,但会收到“找不到视图”消息。
那么我在哪里可以找到此视图? 它在哪里? 有指针吗?
除非model
是string
,否则它可能会映射到Index
局部视图。
当您没有控制器操作的视图(例如:索引)时,可以在“ return View();”上单击鼠标右键。 在控制器方法中自动生成视图。 默认情况下,如果控制器的名称为“ AccountController”,且操作为“ Index”,则视图应位于View \\ Account \\ Index.cshtml中(如果使用剃刀)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.