单项选择题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") %>


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题You are implementing an ASP.NET application that includes a page named TestPage.aspx. TestPage.aspx uses a master page named TestMaster.master.You add the following code to the TestPage.aspx code-behind file to read a TestMaster.master public property named CityName. Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadDim s As String = Master.CityNameEnd Sub  You need to ensure that TestPage.aspx can access the CityName property. What should you do?()

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. 

3.单项选择题You are troubleshooting an ASP.NET Web application. System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state. You need to fix the problem. What should you do?()

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.

6.单项选择题You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another. What should you do?()

A.Replace the GridView control with a ListView control.
B.Set the ClientIDMode attribute to Predictable in the web.config file.
C.Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.
D.Set the @ OutputCache directives VaryByControl attribute to the ID of the GridView control.

7.单项选择题You are implementing an ASP.NET Web site that will be accessed by an international audience. The site contains global and local resources for display elements that must be translated into the language that is selected by the user. You need to ensure that the Label control named lblCompany displays text in the users selected language from the global resource file. Which control markup should you use?()

A.<asp:Label ID="lblCompany" runat="server"  meta:resourcekey="lblCompany" /> 
B.<asp:Label ID="lblCompany" runat="server"    Text="meta:lblCompany.Text" /> 
C.<asp:Label ID="lblCompany" runat="server"  Text="<%$ Resources:lblCompanyText %>" />
D.<asp:Label ID="lblCompany" runat="server"  Text="<%$ Resources:WebResources, lblCompanyText %>" /> 

8.单项选择题You have created an ASP.NET server control named Shopping Cart for use by other developers. Some developers report that the Shopping Cart control does not function properly with ViewState disabled. You want to ensure that all instances of the Shopping Cart control work even if View State is disabled. What should you do?()

A.Require developers to set EnableViewStateMac to true.
B.Store state in ControlState instead of ViewState.
C.Serialize the state into an Application state entry called "MyControl".
D.Require developers to change the session state mode to SQLServer.

9.单项选择题You are creating an ASP.NET Web site. The site has a master page named Custom.master. The code-behind file for Custom.master contains the following code segment.Partial Public Class Custom  Inherits System.Web.UI.MasterPagePublic Property Region As String    Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadEnd SubEnd Class You create a new ASP.NET page and specify Custom.master as its master page.You add a Label control named lblRegion to the new page.  You need to display the value of the master pages Region property in lblRegion.What should you do? ()

A.Add the following code segment to the Page_Load method of the page code-behind file. Dim custom As Custom = Me.Parent  lblRegion.Text = custom.Region
B.Add the following code segment to the Page_Load method of the page code-behind file. Dim custom As Custom = Me.Master  lblRegion.Text = custom.Region
C.Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file. Dim lblRegion As Label = Page.FindControl("lblRegion") lblRegion.Text = Me.Region
D.Add the following code segment to the Page_Load method of the Custom.Master.vb code-behind file. Dim lblRegion As Label = Master.FindControl("lblRegion") lblRegion.Text = Me.Region

最新试题

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 Web application using .NET Framework 4.0. The ASP.NET application is used to track employee performance. It uses Microsoft Windows authentication. Employees are members of a group named Employees.  Managers are members of a group named Managers.  The root folder of the application is named Details. The Details folder displays information about employees„ performance.  The Details folder has a subfolder named MoreDetails. You need to ensure that employees and managers can access pages stored in the Details folder. However, only managers can access pages stored in the MoreDetails folder.   You make the following entries in the Web.config file in the Details folder.You make the following entries in the Web.config file in the MoreDetails folder.When managers try to access pages stored in the MoreDetails folder, they receive the following error message:"An error occurred during the processing of a configuration file required to service this request." You must ensure that managers are able to access pages stored in the MoreDetails folder. What will you do to accomplish this?()

题型:单项选择题

You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual Studio .NET 2010 as its application development platform.  You are creating an ASP.NET Web application using .NET Framework 4.0. The Web application comprises a class named Employee with properties named as First Name, Last Name, and Age. You add a Web page in which you get a list of Employee objects and display those objects in a GridView control. You are required to add code so that the GridView row is highlighted in red color if the age of the employee is less than 21 years.  What will you do to accomplish this?()

题型:单项选择题

You are developing an ASP.NET Web page that uses jQuery validation. The user should enter a valid email address in a text box that has ID txtEmail. The page must display "E-Mail address required" when the user does not enter an address and "Invalid e-mailaddress" when the user enters an address that is not formatted properly. You need to ensure that the appropriate error message is displayed when the text box does not contain a valid e-mail address.  Which two code segments should you add?()

题型:多项选择题

Which method of the ChildActionExtensions class calls a child action method and renders the result inline in the parent view?()

题型:单项选择题

You develop an ASP.NET Web page that includes multiple WebPartZone controls, an EditorZone. Users report that they cannot customize the layout of the page by moving WebParts from one.You need to ensure that users can successfully move Web Parts from one zone to another. What should you do?()

题型:单项选择题

In a page there is a div (I guess it was a div) and you need to execute a javascript function when if first moves the mouse over the element.()

题型:单项选择题

You are perfoming security testing on an existing asp.net web page.You notice that you are able to issue unauthorised postback requests to the page. You need to prevent unauthorised post back requests. which page directive you use?()

题型:单项选择题

Which class is used to specify a set of features to support on the XrnlReader object created by the Create method?()

题型:单项选择题

You are developing an ASP.NET Web application.The application is configured to use the membership and role providers. You need to allow all users to perform an HTTP GET for application resources, but you must allow only the user named Moderator to perform a POST operation.Which configuration should you add to the web.config file?()

题型:单项选择题

You have migrated a web application from .net 3.5 to 4.0. the application hat to render same as in .net 3.5.()

题型:单项选择题