I'm a professional writer and software developer with more than 10 years of experience. I have worked for a lot of businesses and can share sample works with you upon request. Chat me up and let's get started.....
Into the ChildAction methods will not be responded to incoming URL requests. If you try to invoke the childActions using URL, then you will get a runtime error saying – ChildAction is accessible only by a child request.
We can only access the child action methods by making a child request from a view either by using the “Action()” or “RenderAction()” HTML helper methods.
Here, the most important point that you need to remember is, an action method doesn’t need to have the ChildActionOnly attribute to be used as a ChildAction. We need to use this ChildActionOnly attribute only if you want to prevent the action method to be invoked using URL.
The ChildAction methods are different from the NonAction methods in the MVC application. Here, the difference is that the NonAction methods cannot be invoked as a child request either by using the Action() or RenderAction() HTML helpers.
The main advantage of the Child Action method is that you can cache portions of a view. We will discuss this in the OutputCache Attribute article.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
ChildActionOnly Attribute in MVC