4

I am new to asp.net and im have a page that i want to show as a partial view. The page is in a div tag ,like this <div> Html.RenderPartial("view",Model)</div> and im doing the same thing with Html.Render but it works just with RenderPartial.

Does anyone have any idea why,and what es the difference?? i know that Renderpartial ist better for Image and etc.. but is there another difference??? Thx very much :)

1

1 Answer 1

5

This answer should give you what you are looking for (copying relevant sections):

Html.Partial returns a string, Html.RenderPartial calls Write internally, and returns void. The usage (using Razor syntax):

@Html.Partial("ViewName")
@{ Html.RenderPartial("ViewName");  }

Will do exactly the same. You can store the output of Html.Partial in a variable, or return it from a function. You cannot do this with Html.RenderPartial. The result will be written to the Response stream during the execution.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.