1
我有一個控制器位於Controllers文件夾。ASP.NET MVC:調用不同的視圖
Controllers
.... CustomViewController
的CustomViewController執行以下的方法
public ActionResult DisplayPerson()
{
Person prn = new Person();
prn.Name = "Rama";
prn.Email = "[email protected]";
return View(prn);
}
我已經位於CustomView夾兩個視圖
Views
....CustomView
.. DisplayPerson
.. PersonView2
路由
routes.MapRoute(
"Display",
"{Controller}/{action}/{id}",
new { controller = "CustomView",
action = "DisplayPerson", id = "" }
);
問題:
默認情況下,視圖「DisplayPerson」用於顯示人員詳細信息。什麼是 方法在「DisplayPerson()」方法內調用視圖「PersonView2」。
如果你不給個說法的名字,MVC默認爲命名的動作來看,但是這僅僅是一個*默認*。 – Richard 2009-12-31 09:03:38