单项选择题
You are implementing an ASP.NET MVC 2 Web application that contains the following class. Public Class DepartmentControllerInherits Controller Shared departments As List(Of Department) = New List(Of Department) Function Index() As ActionResultReturn View(departments)End Function Function Details(ByVal id As Integer) As ActionResultReturn View(departments.Find(Function(x) x.ID = id))End Function Function ListEmployees(ByVal d As Department) As ActionResultDim employees As List(Of Employee) = GetEmployees(d)Return View (employees)End FunctionEnd Class You create a strongly typed view that displays details for a Department instance. You want the view to also include a listing of department employees. You need to write a code segment that will call the ListEmployees action method and output the results in place. Which code segment should you use?()
A.<%= Html.Action("ListEmployees", Model) %>
B.<%= Html.ActionLink("ListEmployees", "Department", "DepartmentController") %>
C.<% Html.RenderPartial("ListEmployees", Model) %>
D.<%= Html.DisplayForModel("ListEmployees") %>
相关考题
-
单项选择题
YouareimplementinganASP.NETMVC2Webapplicationthatcontainsseveralfolders.TheViews/Shared/DisplayTemplatesfoldercontainsatemplatedhelpernamedScore.ascxthatperformscustomformattingofintegervalues.TheModelsfoldercontainsaclassnamedPlayerwiththefollowingdefinition.PublicClassPlayerPublicPropertyNameAsStringPublicPropertyLastScoreAsIntegerPublicPropertyHighScoreAsIntegerEndClassYouneedtoensurethatthecustomformattingisappliedtoLastScorevalueswhentheHtmlHelper.DisplayForModelmethodiscalledforanyviewintheapplicationthathasamodeloftypePlayer.Whatshouldyoudo?()
A.Rename Score.ascx to LastScore.ascx.
B.Move Score.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/DisplayTemplates folder.
C.Add the following attribute to the LastScore property. <UIHint("Score")>
D.Add the following attribute to the LastScore property. <Display(Name:="LastScore", ShortName:="Score")> -
单项选择题
YouareimplementinganASP.NETapplicationthatincludesapagenamedTestPage.aspx.TestPage.aspxusesamasterpagenamedTestMaster.master.YouaddthefollowingcodetotheTestPage.aspxcode-behindfiletoreadaTestMaster.masterpublicpropertynamedCityName.ProtectedSubPage_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesMe.LoadDimsAsString=Master.CityNameEndSubYouneedtoensurethatTestPage.aspxcanaccesstheCityNameproperty.Whatshouldyoudo?()
A.Add the following directive to TestPage.aspx. <%@ MasterType VirtualPath="~/TestMaster.master" %>
B.Add the following directive to TestPage.aspx. <%@ PreviousPageType VirtualPath="~/TestMaster.master" %>
C.Set the Strict attribute in the @ Master directive of the TestMaster.master page to true.
D.Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true. -
单项选择题
YouaretroubleshootinganASP.NETWebapplication.Systemadministratorshaverecentlyexpandedyourwebfarmfromonetotwoservers.Usersareperiodicallyreportinganerrormessageaboutinvalidviewstate.Youneedtofixtheproblem.Whatshouldyoudo?()
A.Set viewStateEncryptionMode to Auto in web.config on both servers.
B.Set the machineKey in machine.config to the same value on both servers.
C.Change the session state mode to SQLServer on both servers and ensure both servers use the same connection string.
D.Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.
