You create a Web page named TestPage.aspx and a user control

题目
多选题
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]; }

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

You create an ASP.NET page named TestPage.aspx that contains validation controls. You need to verify that all input values submitted by the user have been validated by testing the Page.IsValid property. Which page event should you add an event handler to?()

  • A、Init
  • B、Load
  • C、PreInit
  • D、PreLoad

正确答案:B

第2题:

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); }

正确答案:C

第3题:

You create a Web site. You add an EditorZone control to the home page on the Web site. You need to enable users to customize the size and location of the Web Parts on their home pages.Which two controls should you add to the EditorZone control?()

A. BehaviorEditorPart

B. AppearanceEditorPart

C. PropertyGridEditorPart

D. LayoutEditorPart


参考答案:B, D

第4题:

You create a control named ContosoUI for a Web application. You need to add the control to the toolbox of Microsoft Visual Studio .NET. Which two actions should you perform?()

  • A、Create the ContosoUI control as a Web Control Library.
  • B、Create the ContosoUI control as a Web user control.
  • C、Within the Visual Studio .NET toolbox, browse to and select ContosoUI.ascx.
  • D、Within the Visual Studio .NET toolbox, browse to and select ContosoUI.dll.

正确答案:A,D

第5题:

You are creating a custom user control. The custom user control will be used on 10 Web Forms for an ASP.NET Web site that allows users to register and log on to a personalized experience. The custom user control uses two TextBox controls and two Button controls. You need to ensure that the controls are visible only when users are not logged on to the Web site. You also need to minimize the amount of effort in development and maintenance for the Web site. Which two actions should you perform? ()

  • A、Add the OnClick event handler for the Login button to the code used in the custom user control.
  • B、Add the OnClick event handler for the Login button to the code used in the Web Form where the control is added.
  • C、In the Page_Load method of the Web Form, add a code segment to set the visibility of the TextBox and Button controls where the control is added.
  • D、In the Page_Load method of the custom user control, add a code segment to set the visibility of the TextBox and Button controls.

正确答案:A,D

第6题:

You work as a Web Developer at Certkiller.com. You are in the process of creating a Webapplication using Microsoft ASP.NET 3.5.  You create a folder named Dark in the App_Themes folder of the Web application. You also addfour skin files to this folder. You have to make sure that the controls on a page have their appearances overridden by the control definitions defined in the skin files. What should you do?  Which Page directive should you use?()

  • A、You should use the page directive: <%@ Page StyleSheetTheme="App_Themes.Dark"/>
  • B、You should use the page directive: <%@ Page Theme="App_Themes.Dark"/>
  • C、You should use the page directive: <%@ Page Theme="Dark"/>
  • D、You should use the page directive: <%@ Page StyleSheetTheme="Dark"/>

正确答案:C

第7题:

You create a Web server control named ContosoControls. You add a Web custom control named ContosoMailer to it. You then distribute the Web Control Library files to your team. You need to provide your team with the correct procedure for adding the Web Control Library to the items in the toolbox of Microsoft Visual Studio .NET. Which procedure should you provide to the team?()

  • A、Within the toolbox, click Choose Items and then browse to and select the ContosoControls user control.
  • B、Within the toolbox, click Choose Items and then browse to and select the ContosoMailer user control.
  • C、Right-click Web Project, click Add Reference, and then browse to and select the ContosoControls.dll file.
  • D、Within the toolbox, click Choose Items and then browse to and select the ContosoControls.dll file.

正确答案:D

第8题:

You create a master page named PageBase.master. The master page contains a Label control named lblTitle.You create a content page that references the master page.You need to change the Text property of the master page‘s lblTitle control from the content page.Which code segment should you use?()

A.

B.

C.

D.


参考答案:A

第9题:

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.  You create a custom Web user control named SharedControl. The control will be compiled as a library.  You write the following code segment for the SharedControl control. (Line numbers are included for  reference only.)  01 protected override void OnInit(EventArgs e) 02 {  03 base.OnInit(e);  04  05 }  All the master pages in the ASP.NET application contain the following directive.  <%@ Master Language="C#" EnableViewState="false" %>  You need to ensure that the state of the SharedControl control can persist on the pages that reference a  | English | Chinese | Japan | Korean | - 87 - Test Information Co., Ltd. All rights reserved. master page.  Which code segment should you insert at line 04?()

  • A、Page.RegisterRequiresPostBack(this);
  • B、Page.RegisterRequiresControlState(this);
  • C、Page.UnregisterRequiresControlState(this);
  • D、Page.RegisterStartupScript("SharedControl","server");

正确答案:B

第10题:

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"]; } 

正确答案:A,C

更多相关问题