Which of the following code segments will you use?

You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET MVC 2 Web
application using .NET Framework 4.0. You implement a single project area in the MVC 2 Web
application. In the Areas folder, you add a subfolder named MyTest. You add the following files to
the appropriate sub-folders:
MyController. cs
MyHome.aspx
You register a route of the area, setting the route name to MyTest_default and the area name to
test. You create a view named MyViews.aspx that is outside the test area. You need to add a link to
MyViews.aspx that points to MyHome.aspx. Which of the following code segments will you use?

You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual
Studio .NET 2010 as its application development platform. You create an ASP.NET MVC 2 Web
application using .NET Framework 4.0. You implement a single project area in the MVC 2 Web
application. In the Areas folder, you add a subfolder named MyTest. You add the following files to
the appropriate sub-folders:
MyController. cs
MyHome.aspx
You register a route of the area, setting the route name to MyTest_default and the area name to
test. You create a view named MyViews.aspx that is outside the test area. You need to add a link to
MyViews.aspx that points to MyHome.aspx. Which of the following code segments will you use?

A.
<%= Html.ActionLink(“MyTest”, “MyHome”, new {area = “test”}, null)%>

B.
<%= Html.RouteLink(“MyHome”, “MyTest”, new {area = “test”}, null)%>

C.
<%= Html.RouteLink(“MyTest”, “MyHome”, “MyTest”, new {area = “test”}, null)%>

D.
<%= Html.ActionLink(“MyTest”, “MyHome”, “MyTest”, new {area = “test”}, null)%>

Explanation:
The ActionLink method renders an element that links to an action method. The RouteLink method
renders an element that links to a URL, which can resolve to an action method, a file, a folder, or
some other resource.
LinkExtensions.ActionLink Method
(http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx)
LinkExtensions.RouteLink Method
(http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.routelink.aspx)



Leave a Reply 0

Your email address will not be published. Required fields are marked *