ASP.NET MVC control的action 如何找到对应的view

1,在control的action方法中,返回view(),例如:

public ActionResult Create()
{
return View();
}
2,如何找到对应的view?
When this method is called(即 View();方法) with no arguments, the framework infers
that the name of the view to render should be the same as the name of the action
(Create). Later in the MVC pipeline, the framework’s ControllerActionInvoker class
executes the ViewResult and tells it to render the view. At this point, the framework
asks the  ViewEngineCollection to locate the appropriate view for rendering.
上面的意思:当执行action方法时,如果return view();没有参数的传入,那么框架就会认为,视图的名称是和action名称一样,
随后,在mvc的管道中,按照如下顺序继续调用框架的类:ControllerActionInvoker ——> ViewEngineCollection,通过ViewEngineCollection类,
定位到相应的view并显示。

转载于:https://www.cnblogs.com/yougyoum/archive/2012/08/31/2665177.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值