I have a method in my Home Controller that returns a partial view, but when I run my application I get the error.
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
The Method in my controller gets the model and returns the partial view.
public PartialViewResult _GetToDo()
{
using (KnightOwlContext db = new KnightOwlContext())
{
var todoList = new List<ViewModels.ToDo>();
DashboardHelper dashHelper = new DashboardHelper(db);
var results = dashHelper.GetToDoList(StaffId);
foreach(var r in results)
{
todoList.Add(new ViewModels.ToDo()
{
ToDoId = r.ToDoId,
Complete = r.Complete,
Date = r.Date,
Priority = GetPriority(r.Priority),
StaffId = r.StaffId,
Text = r.Text
});
}
return PartialView("_ToDo", todoList);
}
}
And I call this method in my View:
@Html.Action("_GetToDo", "Home")
The method is in my 'Home Controller' and the Partial View is called from Views > Home > Index
So far I've tried Html.Partial and Html.RenderPartial and neither of those work either with a different error message. I'm completely at a loss as to how to return the partial view, what is it I'm doing wrong?
_ToDo.cshtml
view. Put a break point in the partial view and step through it. Another common cause is that you partial view is generating an infinite loop. – user3559349