单项选择题

You are implementing an ASP.NET page that includes the following drop-down list.
You need to dynamically add values to the end of the drop-down list. What should you do? ()

A.Add the following OnPreRender event handler to the asp:DropDownList
B.Add the following OnPreRender event handler to the asp:DropDownList
C.Add the following event handler to the page code-behind.
D.Add the following event handler to the page code-behind.


您可能感兴趣的试卷

你可能感兴趣的试题

1.多项选择题

You create a custom server control named Task that contains the following code segment.
You need to ensure that adding a Task control from the Toolbox creates markup in the following format. 
  
Which two actions should you perform?()

A.Add the following code segment to the project’s AssemblyInfo.cs file. [assembly: TagPrefix("DevControls", "Dev")]
B.Replace line 05 with the following code segment. [DefaultValue("New Task")]
C.Insert the following code segment immediately before line 03. [ToolboxData("<{0}:Task runat=\"server\" Title=\"New Task\" />")]
D.Replace line 10 with the following code segment. output.Write("<Dev:Task runat=\"server\" Title=\"New Task\" />");

2.多项选择题You use the following declaration to add a Web user control named TestUserControl.ascx to an ASP.NET page named TestPage.aspx.    You add the following code to the code-behind file of TestPage.aspx.  private void TestMethod(){ ...}You define the following delegate.  public delegate void MyEventHandler();  You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and attach the page’s TestMethod method to the event. Which two actions should you perform?()

A.Add the following line of code to TestUserControl.ascx.cs. public event MyEventHandler MyEvent;
B.Add the following line of code to TestUserControl.ascx.cs. public MyEventHandler MyEvent;
C.Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration. <uc:TestUserControl ID="testControl" runat="server" OnMyEvent="TestMethod"/>
D.Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration. <uc:TestUserControl ID="testControl" runat="server" MyEvent="TestMethod"/>

3.多项选择题You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()

A.Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return "New York"; } } 
B.Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = "New York"; 
C.Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; } 
D.Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes["CityName"]; } 

4.单项选择题You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx.You need to dynamically add TestUserControl.ascx to TestPage.aspx. Which code segment should you use?()

A.protected void Page_Load(object sender, EventArgs e) { Control userControl=Page.LoadControl("TestUserControl.ascx"); Page.Form.Controls.Add(userControl); }
B.protected void Page_Load(object sender, EventArgs e) { Control userControl = Page.FindControl("TestUserControl.ascx"); Page.Form.Controls.Load(userControl); }
C.protected void Page_PreInit(object sender, EventArgs e) { Control userControl =Page.LoadControl("TestUserControl.ascx");Page.Form.Controls.Add(userControl); }
D.protected void Page_PreInit(object sender, EventArgs e) { Control userControl = Page.FindControl("TestUserControl.ascx"); Page.Form.Controls.Load(userControl); }

6.单项选择题

You are implementing an ASP.NET Web site. 
The site allows users to explicitly choose the display language for the site's Web pages. You create a Web page that contains a DropDownList named ddlLanguage, as shown in the following code segment.

The site contains localized resources for all page content that must be translated into the language that is selected by the user. You need to add code to ensure that the page displays content in the selected language if the user selects a language in the drop-down list. Which code segment should you use?()

A.protected void SelectedLanguageChanged(object sender, EventArgs e) {Page.UICulture = ddlLanguage.SelectedValue;}
B.protected override void InitializeCulture() {Page.UICulture = Request.Form["ddlLanguage"];}
C.protected void Page_Load(object sender, EventArgs e) {Page.Culture = Request.Form["ddlLanguage"];}
D.protected override void InitializeCulture() {Page.Culture = ddlLanguage.SelectedValue;}

7.单项选择题

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. 
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 page’s 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. CustomMaster custom = this.Parent as CustomMaster; lblRegion.Text = custom.Region;
B.Add the following code segment to the Page_Load method of the page code-behind file. CustomMaster custom = this.Master as CustomMaster; lblRegion.Text = custom.Region;
C.Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file. Label lblRegion = Page.FindControl("lblRegion") as Label; lblRegion.Text = this.Region;
D.Add the following code segment to the Page_Load method of the Custom.Master.cs code-behind file. Label lblRegion = Master.FindControl("lblRegion") as Label; lblRegion.Text = this.Region;

8.单项选择题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 void Page_Load(object sender, EventArgs e) { string s = Master.CityName; }  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" %><%@ mastertype="" virtualpath="~/TestMaster.master">
B.Add the following directive to TestPage.aspx. <%@ PreviousPageType VirtualPath="~/TestMaster.master" %><%@ 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.

9.单项选择题You are developing an ASP.NET Web page that contains input controls, validation controls, and a button named btnSubmit.  The page has the following code-behind.01 Public Class _Default  02 Inherits System.Web.UI.Page03   04 Protected Sub SaveToDatabase()05   06 End Sub07   08 Protected Sub btnSubmit_Click(ByVal sender As Object,09 ByVal e As EventArgs) Handles btnSubmit.Click10   11 End Sub12   13 End Class  You need to ensure that all data that is submitted passes validation before the data is saved in a database. What should you do? ()

A.Add the following method override. Protected Overrides Sub OnInit(ByVal e As EventArgs)  MyBase.OnInit(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
B.Add the following method override. Protected Overrides Sub OnLoad(ByVal e As EventArgs)  MyBase.OnLoad(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
C.Add the following method override.Protected Overrides Sub OnPreRender(ByVal e As EventArgs)  MyBase.OnPreRender(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
D.Add the following code segment at line 10. If (Page.IsValid) Then Me.SaveToDatabase()

10.单项选择题You create a new ASP.NET MVC 2 Web application. The following default routes are created in the Global.asax.vb file.01 Shared Sub RegisterRoutes(ByVal routes As RouteCollection)02  03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}")04  05 routes.MapRoute( "Default", "{controller}/{action}/{id}", New With {.controller = "Home", .action = "Index", .id = ""})  06 End Sub  You implement a controller named HomeController that includes methods with the following signatures.Function Index() As ActionResult  Function Details(ByVal id As Integer) As ActionResultFunction DetailsByUsername(   ByVal username As String) As ActionResult  You need to add a route to meet the following requirements.   The details for a user must be displayed when a user name is entered as the path by invoking the DetailsByUsername action.  User names can contain alphanumeric characters and underscores, and can be between 3 and 20 characters long.What should you do?()

A.Replace line 05 with the following code segment. routes.MapRoute( "Default", "{controller}/{action}/{id}", New With {.controller = "Home", .action = "DetailsByUsername", .id = ""})
B.Replace line 05 with the following code segment. routes.MapRoute("Default", "{controller}/{action}/{username}", New With {.controller = "Home", .action = "DetailsByUsername", .username = ""}, New With {.username = "\w{3,20}"} )
C.At line 04, add the following code segment.routes.MapRoute( "Details byUsername""{username}", New With {.controller = "Home", .action = "DetailsByUsername"}, New With {.username = "\w{3,20}"})
D.At line 04, add the following code segment. routes.MapRoute( "Details by Username", "{id}",  New With {.controller = "Home", .action = "DetailsByUsername"}, New With {.id = "\w{3,20}"} )

最新试题

You have a login.ascx control and to display it in a view which method u would use()

题型:单项选择题

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?()

题型:单项选择题

ou are developing an ASP.NET MVC 2 application. You create a view that will be returned by action methods in multiple controllers. You need to place the view in the appropriate folder. To which subfolder within the Views folder should you add the view?()

题型:单项选择题

A library called contosobuisness.dll has been created and u need to accept it in a page.. all options had the <%assembly tag but the att differed.()

题型:单项选择题

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 to store user data of 200 KB in an object. Which state management technique to use:()

题型:单项选择题

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?()

题型:多项选择题

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 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?()

题型:单项选择题

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

题型:单项选择题