ChildActionOnly attribute
1. Any action method that is decorated with [ChildActionOnly] attribute is a child action method.
2. Child action methods will not respond to URL requests. If an attempt is made, a runtime error will be thrown stating - Child action is accessible only by a child request.
3. Child action methods can be invoked by making child request from a view using "Action()" and "RenderAction()" HTML helpers.
4. An action method doesn’t need to have [ChildActionOnly] attribute to be used as a child action, but use this attribute to prevent if you want to prevent the action method from being invoked as a result of a user request.
5. Child actions are typically associated with partial views, although this is not compulsory.
6. Child action methods are different from NonAction methods, in that NonAction methods cannot be invoked using Action() or RenderAction() helpers.
7. Using child action methods, it is possible to cache portions of a view. This is the main advantage of child action methods.
[ChildActionOnly]
public ActionResult Employee(List<String> empData)
{
return View(empData);
}
1. Any action method that is decorated with [ChildActionOnly] attribute is a child action method.
2. Child action methods will not respond to URL requests. If an attempt is made, a runtime error will be thrown stating - Child action is accessible only by a child request.
3. Child action methods can be invoked by making child request from a view using "Action()" and "RenderAction()" HTML helpers.
4. An action method doesn’t need to have [ChildActionOnly] attribute to be used as a child action, but use this attribute to prevent if you want to prevent the action method from being invoked as a result of a user request.
5. Child actions are typically associated with partial views, although this is not compulsory.
6. Child action methods are different from NonAction methods, in that NonAction methods cannot be invoked using Action() or RenderAction() helpers.
7. Using child action methods, it is possible to cache portions of a view. This is the main advantage of child action methods.
[ChildActionOnly]
public ActionResult Employee(List<String> empData)
{
return View(empData);
}
No comments:
Post a Comment