exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 64 discussion

Actual exam question from Microsoft's 70-486
Question #: 64
Topic #: 1
[All 70-486 Questions]

You develop an ASP.NET MVC application. The application has a controller named PeopleController.cs. The controller has an action method that returns a parent view. The parent view includes the following code. Line numbers are included for the reference only.

The application also contains a partial view named People. The parent view must display the partial view.
You need to add code at line 09 to display the partial view within the parent view.
Which two code segments will achieve the goal? Each correct answer presents a complete solution.

  • A. @{ Html.RenderPartial("People", Model);}
  • B. @Html.Partial("People", Model)
  • C. @Html.Display("People", Model)
  • D. @Html.Raw("People")
Show Suggested Answer Hide Answer
Suggested Answer: AB 🗳️
By default, any partial view rendered bycalling @Html.Partial("PartialViewName") will get the view model passed to the parent view.
Reference: How to populate mvc razor partial view
http://stackoverflow.com/questions/13769707/how-to-populate-mvc-razor-partial-view

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
hungry_ape9000
5 years, 2 months ago
FINAL ANSWER: @{ Html.RenderPartial("People", Model); } @Html.Partial("People", Model); Also in .NET Core but not listed here: <partial name="People" for="Model" /> https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/partial-tag-helper?view=aspnetcore-3.1
upvoted 4 times
...
tanujgyan
5 years, 2 months ago
Check both the syntax here https://stackoverflow.com/questions/5248183/html-partial-vs-html-renderpartial-html-action-vs-html-renderaction
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...