Fatemeh Montazeri
Fatemeh Montazeri

Reputation: 31

Error executing child request for handler

I use a child action in Home Controller like this:

  [OutputCache(Duration=30)]
    public ActionResult ChildAction()
    {
        Response.Write("Date Time is="+DateTime.Now);
        return View();
    }

Home.cshtml
<h2>About</h2>
<p>
   @Html.Action("ChildAction")  
</p>

but after run my asp.net mvc3.0 Project i get an error :

The view 'ChildAction' or its master was not found or no view engine supports the searched locations. The following locations were searched:

~/Views/Home/ChildAction.aspx
~/Views/Home/ChildAction.ascx
~/Views/Shared/ChildAction.aspx
~/Views/Shared/ChildAction.ascx
~/Views/Home/ChildAction.cshtml
~/Views/Home/ChildAction.vbhtml
~/Views/Shared/ChildAction.cshtml
~/Views/Shared/ChildAction.vbhtml

please help me how can i solve it thanks

Upvotes: 1

Views: 214

Answers (1)

serefbilge
serefbilge

Reputation: 1714

You should have a view named "ChildAction", or in action you should return view as
return View("ViewName"); In summary, view name should be same as action name, not controller name as you did(You named view as "Home").

Upvotes: 1

Related Questions