2
votes

I am receiving a

"Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'"

error message using the code below. I have tried suggestions in several other questions posted here and none have worked. Can anyone spot what I'm doing wrong and give me straightforward, novice-level instructions to fix it?

Partial view HomeContent:

@model JobBoard.Models.HomeContentModel

<div id="about-text">
    @Model.HomeContent
</div>

Controller:

    [ChildActionOnly] 
    public ActionResult HomeContent(int CompanyId)
    {
        string cid = Convert.ToString(CompanyId);
        HomeContentModel content = new HomeContentModel();
        content.HomeContent = (from c in db.Companies
                               where c.TW_CompanyID == cid
                               select c.JBContent).First();
        return PartialView(content);
    }

View:

 @{Html.RenderAction("HomeContent");}

(I have also tried Action, Partial and RenderPartial. The partials work, but of course do not trigger the ActionResult, which I need).

1

1 Answers

1
votes

You need to pass in an int i.e:

@Html.Action("HomeContent", 1);

This would probably come from you Model though.

Without seeing your model, I'm guessing it would be something like this:

@Html.Action("HomeContent", Model.CompanyId);