Child Action

Control


[ChildActionOnly]      //只能用于Child Action
public ActionResult Time() {
return PartialView(DateTime.Now);
}

View


@model DateTime
<p>The time is: @Model.ToShortTimeString()</p>

@Html.Action("Time")

与分布视图不同的是,Child Action可以在Control中提供需要的数据。

原文地址:https://www.cnblogs.com/dotnetmvc/p/3826922.html