Error executing child request for handler in view

I just got this error occurring in my razor when my partial view had a code formatting error in it.

If you click 'Continue' to get past the error, you'll see the actual error message displayed in the browser window that you loaded it from.

Correct the error in the partial view and it'll work!


Ok I found the problem, hopefully this will help someone in future.

The controllers for the partial views each contained the [HttpGet] attribute. For example

[HttpGet]
public ActionResult Index()
{
}

I remove the attribute from both controllers

public ActionResult Index()
{
}

and everything is now working.


Replace:

return View(manageAdministratorModel);

with:

return PartialView(manageAdministratorModel);

otherwise you might be ending in an infinite loop because you are rendering a view which is attempting to render a view which is attempting to render a view, ...

Also you might need to remove the [HttpPost] attribute from your child action.