Tag Archives: How to call child method in Asp.Net MVC.

How to call child action method in Asp.Net MVC.

Child action methods can not be called directly. They have to call from inside of a view.
We can make an Action method a child action method by decorating it with [ChildActionOnly] attribute.

[ChildActionOnly]
public ActionResult Child()
{   
    return View();
}


Calling child action method from inside of a view

@Html.Action("Child", "Home")


Where “Child” is the Action method name and “Home” is the controller name.