4

My partial view, called _myTestView.cshtml

<div style="border:1px solid red;">

TEST

</div>

I call it like that

<div>
  @Html.RenderPartial("_myTestView");
</div>

I get the following run time error

Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

What am I doing wrong?

2 Answers 2

3

You're not inside a code block, so you don't use .RenderPartial

Just use .Partial and get rid of the ;

<div>
  @Html.Partial("_myTestView")
</div>
Sign up to request clarification or add additional context in comments.

Comments

1

Put it inside a code block

@{Html.RenderPartial("_myTestView");}

related What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model) in MVC2?

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.