You are implementing a read-only page that includes the following controls.
You disable view state to improve performance. You need to ensure that the page is updated to display the latest data when the user clicks the refresh button. Which code segment should you use?()
A.protected void Page_PreInit(object sender, EventArgs e) { if (!IsPostBack) { gvCustomers.DataSource = GetCustomers(); gvCustomers.DataBind(); } }
B.protected void Page_Load(object sender, EventArgs e) { gvCustomers.DataSource = GetCustomers(); gvCustomers.DataBind(); }
C.protected void gvCustomers_DataBinding(object sender, EventArgs e) { gvCustomers.DataSource = GetCustomers(); gvCustomers.DataBind(); }
D.protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { gvCustomers.DataSource = GetCustomers(); gvCustomers.DataBind(); } }
您可能感兴趣的试卷
你可能感兴趣的试题
A.btnAddToCart_Click
B.Page_Load
C.Page_PreRender
D.Page_PreInit
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 %>" />
A.the EnableEventValidation attribute
B.the ResponseEncoding attribute
C.the ValidateRequest attribute
D.the Strict attribute
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") %>
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)
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.
最新试题
Which control allows you to bind to data items that are returned from a data source and display them?()
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?()
Which class is used to specify a set of features to support on the XrnlReader object created by the Create method?()
You have to store user data of 200 KB in an object. Which state management technique to 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 have recently finished the development of an ASP.NET Web application using .NET Framework 4.0. Now, you are deploying the ASP.NET Web application to a remote server. You are required to select a deployment method that will make sure that all Internet Information Services (IIS) settings, in addition to the Web content, are deployed to the remote server. Which of the following deployment methods will you select 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 create an ASP.NET Web application using .NET Framework 4.0. You create a Web page in the application. The Web page will get large sets of data from a data source. You add a DataPager control to the page. You are required to display navigation controls that enable you to create a custom paging Ul for the DataPager control. What will you do?()
In a web page with chechboxes you need to write e jquery that retruns the number checked checkboxes.()
Which class defines the contract that ASP.NET implements to provide membership services using custom membership providers?()
Which utility allows you to pre-compile and publish your Web site to a new location?()
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()