单项选择题

You are implementing an ASP.NET MVC 2 Web application that contains the following 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") %>


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

You create an ASP.NET MVC 2 Web application that contains the following controller class.
In the Views folder of your application, you add a view page named Index.aspx that includes the following @ Page directive.

You test the application with a browser.You receive the following error message when the Index method is invoked: "The view 'Index' or its master was not found." You need to resolve the error so that the new view is displayed when the Index method is invoked.What should you do?()

A.Change the name of the Index.aspx file to Product.aspx.
B.Create a folder named Product inside the Views folder. Move Index.aspx to the Product folder.
C.Replace the @ Page directive in Index.aspx with the following value.
D.Modify the Index method by changing its signature to the following:public ActionResult Index(Product p)

5.单项选择题You are implementing an ASP.NET MVC 2 Web application. The URL with path /Home/Details/{country} will return a page that provides information about the named country. You need to ensure that requests for this URL that contain an unrecognized country value will not be processed by the Details action of HomeController. What should you do?()

A.Add the ValidateAntiForgeryToken attribute to the Details action method.
B.Add the Bind attribute to the country parameter of the Details action method. Set the attribute’s Prefix property to Country.
C.Create a class that implements the IRouteConstraint interface. Configure the default route to use this class.
D.Create a class that implements the IRouteHandler interface. Configure the default route to use this class.

7.单项选择题

You are implementing an ASP.NET Dynamic Data Web site. The Web site includes a data context that enables automatic scaffolding for all tables in the data model. The Global.asax.cs file contains the following code segment.
You need to display the items in a table named Products by using a custom layout. What should you do?()

A.Add a new Web page named Products.aspx to the Dynamic Data\PageTemplates folder of the Web site.
B.Add a new folder named Products to the Dynamic Data\CustomPages folder of the Web site. Add a new Web page named ListDetails.aspx to the Products folder.
C.Add a new Web user control named Products.ascx to the Dynamic Data\Filters folder of the Web site. In the code-behind file for the control, change the base class from UserControl to  System.Web.DynamicData.Query.
D.Add a new Web user control named Products_ListDetails.ascx to the DynamicData\EntityTemplates folder of the Web.In the code-behind file for the control, change the base class from UserControl to System.Web.DynamicData.Entity.

8.多项选择题

You are implementing an ASP.NET Web site. The site contains the following class. 
The Web site interacts with an external data service that requires Address instances to be given in the following XML format.

You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format requirements of the external data service. Which two actions should you perform.()

A.Add the following attribute to the AddressType field. [XmlAttribute]
B.Add the following attribute to the Line2 field. [XmlElement(IsNullable=true)]
C.Add the following attribute to the ZipPostalCode field. [XmlAttribute("ZipCode")]
D.Add the following attribute to the ZipPostalCode field. [XmlElement("ZipCode")]

9.多项选择题

You are implementing an ASP.NET Web site. The Web site contains a Web service named CustomerService. The code-behind file for the CustomerService class contains the following code segment.

You need to ensure that the GetProducts method can be called by using AJAX.Which two actions should you perform?()

A.Apply the WebService attribute to the ProductService class.
B.Apply the ScriptService attribute to the ProductService class.
C.Apply the WebMethod attribute to the GetProducts method.
D.Apply the ScriptMethod attribute to the GetProducts method.

10.单项选择题

You are implementing an ASP.NET application. You add the following code segment.
You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list. The resulting list must not contain duplicates. Which code segment should you use?()

A.var secretPeople = (from p in allPeople from u in secretUsers  where p.UserId == u select p).Distinct(); return allPeople.Except(secretPeople);
B.return from p in allPeople from u in secretUsers where p.UserId != u select p;
C.return (from p in allPeople  from u in secretUsers where p.UserId != u select p).Distinct();
D.List people = new List( from p in allPeople from u in secretUsers where p.UserId != u select p); return people.Distinct();

最新试题

Which event of the GridView class occurs when the Edit button of a row is clicked, but before the GridView control enters edit mode?()

题型:单项选择题

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 class defines the contract that ASP.NET implements to provide membership services using custom membership providers?()

题型:单项选择题

You have to store user data of 200 KB in an object. Which state management technique to use:()

题型:单项选择题

You create an ASP.NET server control in the SampleControl namespace. The control uses a JavaScript file names Refresh.js to implement AJAX functionality.You need to ensre that the JavaScript file is included in the assembly. Which two actions should you perform?()

题型:多项选择题

You have a login.ascx control and to display it in a view which method u would 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 Web application using .NET Framework 4.0. The Web application connects to a SQL Server database. You use the ADO.NET Entity Framework to handle persistence-ignorant entities. You create an ObjectContext object named ObjContext. Subsequently, you change properties on numerous entities. You are required to save the changed entity values in the SQL Server database. Which of the following code segments will you use?()

题型:单项选择题

You are debugging an ASP.NET Web application by using the Visual Studio debugger. The application is incorrectly handling a SQL Exception on the login page. You need to break execution where the exception is thrown . What should you do?()

题型:单项选择题

You are developing a WCF service. The service includes an operation names GetProduct. You need to ensure that GetProduct will accept a POST request and will indicate that the returned data is XML.  Which two actions should you perform?()

题型:多项选择题

Which class provides paging functionality for data-bound controls that implement the IPageableItemContainer interface?()

题型:单项选择题