You are implementing an ASP.NET MVC 2 Web application that contains several folders. The Views/Shared/DisplayTemplates folder contains a templated helper named Score.ascx that performs custom formatting of integer values. The Models folder contains a class named Player with the following definition.
You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper.DisplayForModel method is called for any view in the application that has a model of type Player. What should you do?()
A.Rename Score.ascx to LastScore.ascx.
B.Move Score.ascx from the Views/Shared/DisplayTemplates folder to theViews/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")]
您可能感兴趣的试卷
你可能感兴趣的试题
You are implementing an ASP.NET MVC 2 Web application. A controller contains the following code.
The first Edit action displays the user whose details are to be edited, and the second Edit action is called when the Save button on the editing form is clicked to update the user details. An exception is thrown at run time stating that the request for action Edit is ambiguous. You need to correct this error and ensure that the controller functions as expected.What are two possible ways to achieve this goal?()
A.Add the following attribute to the first Edit action. [AcceptVerbs(HttpVerbs.Head)]
B.Add the following attribute to the first Edit action. [HttpGet]
C.Add the following attribute to the second Edit action. [HttpPost]
D.Add the following attribute to the second Edit action. [HttpPut]
A.[Authorize(Users = "")]
B.[Authorize(Roles = "")]
C.[Authorize(Users = "*")]
D.[Authorize(Roles = "*")]
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.
A.Add a DynamicDataManager control to the Web page.
B.Disable the auto-generated fields on GridView1. Add a DynamicField control for each field of the Product class.
C.Add the following code segment to the Application_Start method in the Global.asax.cs file.
D.Add the following code segment to the Page_Init method of the Web page.
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.
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")]
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.
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
You are implementing an ASP.NET application that uses LINQ to Entities to access and update the database.The application includes the following method to update a detached entity of type Person.
You need to implement the UpdatePerson method to update the database row that corresponds to the personToEdit object. Which code segment should you use?()
A._entities.People.Attach(personToEdit); _entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Modified); _entities.SaveChanges();
B._entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Added);_entities.SaveChanges();
C._entities.People.ApplyCurrentValues(personToEdit); _entities.SaveChanges();
D._entities.People.Attach(new Person() { Id = personToEdit.Id });_entities.ObjectStateManager.ChangeObjectState(personToEdit, EntityState.Modified);_entities.SaveChanges();
You are implementing an ASP.NET page. Client-side script requires data. Your application includes a class named Person with a Name property of type string. The code-behind file of the page includes the following code segment.
You need to use the JavaScriptSerializer class to serialize only the Name property of each item in the people list. Which code segment should you use?()
A.JsonValue = json.Serialize(people.Select(p => p.Name));
B.var names = from person in people select person; JsonValue = "{" + json.Serialize(names) + "}";
C.JsonValue = json.Serialize(people.SelectMany( p =>Name.AsEnumerable()));
D.var names = from person in people select person; JsonValue = json.Serialize(names);
最新试题
You are developing an ASP.NET MVC 2 Web Application. You need to implement an asynchronous controller named AccountingController, and you must ensure that the export action required proper authorization.Which code segment should you use?()
Which of the following is the correct collection of build events?()
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 have to store user data of 200 KB in an object. Which state management technique to use:()
You have a master page custom.master ... u create a nested.master page using it ... and then u have content page that uses the nested.master as its master page ... to get a string prop from custom.master into a label in content page the code u wud use()
The page will be posted to the server after one or more image files are selected for upload.You need to ensure that all unuploaded files are saved to the server within one call to a single event handler. What should you do? ()
You are developing an ASP.NET Web application. The application must pass an object that contains user-specific data between multiple pages. The object ismore than 100 KB in size when serialized.You need to minimize the amount of data is sent to the user.What should you do?()
Which control allows you to bind to data items that are returned from a data source and display them?()
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?()
Which method of the Page class searches the page naming container for a server control with a particular identifer?()