PrepAway - Latest Free Exam Questions & Answers

What should you do?

You are implementing an ASP.NET MVC 2 Web application.
You create a shared user control named MenuBar.ascx that contains the application’s menu.
You need to use the menu bar in all application views.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
In the site’s master page, create a div element with an ID of Navigation.
Add the following code segment inside this div element.
<% Html.RenderPartial(“~/Views/Shared/MenuBar.ascx”); %>

B.
In the site’s master page, create a div element with an ID of Navigation.
Add the following code segment inside this div element.
<%= Url.Content(“~/Views/Shared/MenuBar.ascx”) %>

C.
In each of the controller’s action methods, add an entry to the ViewData collection with a key of Navigation and a value of ~/Views/Shared/MenuBar.ascx.

D.
In the site’s Global.asax.cs file, register a route named Navigation that points to the ~/Views/Shared/MenuBar.ascx file.


Leave a Reply