内容简介:版权声明:本文为博主原屙文章,喜欢你就担走。 https://blog.csdn.net/leftfist/article/details/83212369
版权声明:本文为博主原屙文章,喜欢你就担走。 https://blog.csdn.net/leftfist/article/details/83212369
其实, asp.net mvc 里的Url.Action与Url.RenderAction,这根本就是两个不同类的东西,不能相提并论。唯一有联系的,就是都跟action有关。记录下来,主要是做个备忘录。
1、Url.Action()
其实就是输出一个链接。可以传参数
<a href="@Url.Action("Main",new { id = Model.ID})">任务明细</a>
输出到网页就是:
<a href="/YbjzHpm.Web/Business/Task/Main/13">任务明细</a>
对应的action代码:
public ActionResult Main(long id)
{
return View();
}
2、Url.RenderAction()
输出该Action所对应的视图。也可以传参数
@model Task
<div>
@{
Html.RenderAction("Main2", new { model = Model});
}
</div>
public ActionResult Main2(Task model)
{
return View("Main",model);
}
以上所述就是小编给大家介绍的《asp.net mvc 里的Url.Action与Url.RenderAction》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Algorithms + Data Structures = Programs
Niklaus Wirth / Prentice Hall / 1975-11-11 / GBP 84.95
It might seem completely dated with all its examples written in the now outmoded Pascal programming language (well, unless you are one of those Delphi zealot trying to resist to the Java/.NET dominanc......一起来看看 《Algorithms + Data Structures = Programs》 这本书的介绍吧!