[英]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.