2

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 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.