[英]ASP.NET MVC : Calling Different View
I have a controller located in Controllers folder. 我在Controllers文件夹中有一个控制器。
Controllers
.... CustomViewController
The CustomViewController executes the following method CustomViewController执行以下方法
public ActionResult DisplayPerson()
{
Person prn = new Person();
prn.Name = "Rama";
prn.Email = "Jass@yahoo.com";
return View(prn);
}
I have two views located in CustomView folder 我在CustomView文件夹中有两个视图
Views
....CustomView
.. DisplayPerson
.. PersonView2
Routing 路由
routes.MapRoute(
"Display",
"{Controller}/{action}/{id}",
new { controller = "CustomView",
action = "DisplayPerson", id = "" }
);
Question : 题 :
By default the view "DisplayPerson" is used to display the Person details.What is the way to call the view "PersonView2" inside the "DisplayPerson()" method. 默认情况下,视图“ DisplayPerson”用于显示“人员”详细信息。在“ DisplayPerson()”方法内调用视图“ PersonView2”的方式是什么。
return View("DisplayPerson", prn)
or 要么
return View("PersonView2", prn)
http://msdn.microsoft.com/en-us/library/dd460310.aspx http://msdn.microsoft.com/en-us/library/dd460310.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.