This article references:http://www.cnblogs.com/willick/p/3410855.html
1. Child action is similar to Patial view and can be reused for the same sub-content in different parts of the application. The difference is that it renders the child content by invoking the action method in the controller, and typically contains the processing of the business. Any action can act as a child action. Example:
// 1, childactiononly features ensure that the action Can only be called as a child action (not required) [childactiononly] Public ActionResult time () { return Partialview (DateTime.Now);} // 2, View time.cshtml @model DateTime <p>the time is : @ Model.toshorttimestring () </p> // 3, in Add the following code to the List.cshtml view to invoke the time action method: @Html. Action ( " time " )
The time action method is called by the @Html. Action method to render the child content. In this method we only pass an action name parameter, and MVC will find the action based on the current view's controller. If you are invoking the action method in another controller, you need to specify the controller's name in the second parameter, as follows:
@Html. Action ("time""mycontroller")
The method can also pass values to the parameters of the action method, such as the action with the following parameters:
Public actionresult Time (DateTime time) { return Partialview (time);} @Html. Action ("time"new {time = DateTime.Now})
"ASP. NET MVC Learning Notes"-child Action