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?

题目

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

相似考题

2.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 SubB、Add the following method override. Protected Overrides Sub OnLoad(ByVal e As EventArgs)  MyBase.OnLoad(e) If (Page.IsValid) Then Me.SaveToDatabase() End SubC、Add the following method override.Protected Overrides Sub OnPreRender(ByVal e As EventArgs)  MyBase.OnPreRender(e) If (Page.IsValid) Then Me.SaveToDatabase() End SubD、Add the following code segment at line 10. If (Page.IsValid) Then Me.SaveToDatabase()

更多“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?”相关问题
  • 第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 add an event handler to?()

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

    正确答案:B

  • 第2题:

    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 Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadDim s As String = Master.CityNameEnd Sub  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" %> 
    • B、Add the following directive to TestPage.aspx. <%@ 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. 

    正确答案:A

  • 第3题:

    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

  • 第4题:

    You are developing an ASP.NET Web application. You create a master page. The master page requires a region where you can add page-specific content by using the ASP.NET page designer.  You need to add a control to the master page to define the region. Which control should you add?()

    • A、Content
    • B、ContentPlaceHolder
    • C、PlaceHolder
    • D、Substitution

    正确答案:B

  • 第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 are developing an ASP.NET Web application. You create a master page. The master page requires a region where you can add page-specific content by using theASP.NET page designer. You need to add a control to the master page to define the region. Which control should you add?()

    • A、PlaceHolder
    • B、ContentPlaceHolder
    • C、Content
    • D、Substituition

    正确答案:B

  • 第7题:

    You are implementing an ASP.NET application. The application includes a Person class with property Age. You add a page in which you get a list of Person objects and display the objects in a GridView control. You need to add code so that the GridView row is highlighted in red if the age of the person is less than 18. Which GridView event should you handle?()

    • A、RowDataBound
    • B、RowCommand
    • C、RowUpdated
    • D、RowEditing

    正确答案:A

  • 第8题:

    单选题
    You create a Web site that stores users' active themes in user profile objects. You need to apply users' preferred themes when they log on to the Web site. What should you do? ()
    A

    In the InitComplete event handler, set the Theme property of the Page object based on the user profile.

    B

    In the PreLoad event handler, set the Theme property of the Page object based on the user profile.

    C

    In the OnLoad event handler, set the Theme property of the Page object based on the user profile.

    D

    In the PreInit event handler, set the Theme property of the Page object based on the user profile.


    正确答案: C
    解析: 暂无解析

  • 第9题:

    单选题
    You develop a Web application that contains two master pages. You need to dynamically set the master page when a user views pages in the application. What should you do?()
    A

    SetPage.MasterPageFile in the Page’sPage_Initevent.

    B

    SetPage.MasterPageFile in the Page’sOnInit event.

    C

    SetPage.MasterPageFile in the Page’sPage_Loadevent.

    D

    SetPage.MasterPageFile in the Page’sPage_PreInitevent.


    正确答案: D
    解析: 暂无解析

  • 第10题:

    多选题
    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.


    正确答案: D,B
    解析: 暂无解析

  • 第11题:

    单选题
    You are developing an ASP.NET Web page that will display the median value from a sequence of integer values. You need to create an extension method to compute the median value. Which interface should you add the extension method to?()
    A

     IComparer<T>

    B

     IEnumerable<T>

    C

     IEnumerator<T>  

    D

     IEqualityComparer<T>


    正确答案: B
    解析: 暂无解析

  • 第12题:

    单选题
    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()


    正确答案: D
    解析: 暂无解析

  • 第13题:

    You develop a Web application that contains two master pages. You need to dynamically set the master page when a user views pages in the application. What should you do? ()

    • A、Set Page.MasterPageFile in the Page's Page_Init event.
    • B、Set Page.MasterPageFile in the Page's OnInit event.
    • C、Set Page.MasterPageFile in the Page's Page_Load event.
    • D、Set Page.MasterPageFile in the Page's Page_PreInit event.

    正确答案:D

  • 第14题:

    You use Microsoft .NET Framework 4 to create a Windows Forms application. You add a new class named Customer to the application. You select the Customer class to create a new object data source. You add the following components to a Windows Form: A BindingSource component named customerBindingSource that is data-bound to the Customer object data source. A set of TextBox controls to display and edit the Customer object properties. Each TextBox control is data-bound to a property of the customerBindingSource component. An ErrorProvider component named errorProvider that validates the input values for each TextBox control. You need to ensure that the input data for each TextBox control is automatically validated by using the ErrorProvider component. Which two actions should you perform?()

    • A、 Implement the validation rules inside the Validating event handler of each TextBox control by throwing an exception when the value is invalid.
    • B、 Implement the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid.
    • C、 Implement the validation rules inside the setter of each property of the Customer class by throwing an exception when the value is invalid.
    • D、 Add the following code segment to the InitializeComponent method of the Windows Form.   this.errorProvider.DataSource = this.customerBindingSource;
    • E、 Add the following code segment to the InitializeComponent method of the Windows Form.    this.errorProvider.DataSource = this.customerBindingSource.DataSource;    this.errorProvider.DataMember = this.customerBindingSource.DataMember;

    正确答案:C,D

  • 第15题:

    You develop a Web application that contains two master pages. You need to dynamically set the master page when a user views pages in the application. What should you do? ()

    • A、Set Page.MasterPageFile in the Page's Page_Init event.
    • B、Set Page.MasterPageFile in the Page's OnInit override.
    • C、Set Page.MasterPageFile in the Page's Page_Load event.
    • D、Set Page.MasterPageFile in the Page's Page_PreInit event.

    正确答案:D

  • 第16题:

    You are testing an existing ASP.NET page. The page includes a text box. You are able to execute malicious JavaScript code by typing it in the text box and submitting. You need to configure the page to prevent JavaScript code from being submitted by the text box. In the @ Page directive, which attribute should you set to true?()

    • A、the EnableEventValidation attribute
    • B、the ResponseEncoding attribute
    • C、the ValidateRequest attribute
    • D、the Strict attribute

    正确答案:C

  • 第17题:

    You are developing an ASP.NET Web page that will display the median value from a sequence of integer values. You need to create an extension method to compute the median value. Which interface should you add the extension method to?()

    • A、 IComparer<T>
    • B、 IEnumerable<T>
    • C、 IEnumerator<T>  
    • D、 IEqualityComparer<T>

    正确答案:B

  • 第18题:

    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"/>

    正确答案:A,C

  • 第19题:

    单选题
    You are implementing an ASP.NET page in an e-commerce application. Code in abtnAddToCart_Click event handler adds a product to the shopping cart. The page should check the status of the shopping cart and always show a cart icon when one or more items are in the shopping cart. The page should hide the icon when the shopping cart has no items. You need to add an event handler to implement this requirement. Which event handler should you add?()
    A

    btnAddToCart_Click

    B

    Page_Load

    C

    Page_PreRender

    D

    Page_PreInit


    正确答案: C
    解析: 暂无解析

  • 第20题:

    多选题
    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/>


    正确答案: D,C
    解析: 暂无解析

  • 第21题:

    多选题
    You use Microsoft .NET Framework 4 to create a Windows Forms application. You add a new class named Customer to the application. You select the Customer class to create a new object data source. You add the following components to a Windows Form: A BindingSource component named customerBindingSource that is data-bound to the Customer object data source. A set of TextBox controls to display and edit the Customer object properties. Each TextBox control is data-bound to a property of the customerBindingSource component. An ErrorProvider component named errorProvider that validates the input values for each TextBox control. You need to ensure that the input data for each TextBox control is automatically validated by using the ErrorProvider component. Which two actions should you perform?()
    A

     Implement the validation rules inside the Validating event handler of each TextBox control by throwing an exception when the value is invalid.

    B

     Implement the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid.

    C

     Implement the validation rules inside the setter of each property of the Customer class by throwing an exception when the value is invalid.

    D

     Add the following code segment to the InitializeComponent method of the Windows Form.   this.errorProvider.DataSource = this.customerBindingSource;

    E

     Add the following code segment to the InitializeComponent method of the Windows Form.    this.errorProvider.DataSource = this.customerBindingSource.DataSource;    this.errorProvider.DataMember = this.customerBindingSource.DataMember;


    正确答案: C,D
    解析: 暂无解析

  • 第22题:

    多选题
    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.


    正确答案: C,D
    解析: 暂无解析

  • 第23题:

    单选题
    You are testing an existing ASP.NET page. The page includes a text box. You are able to execute malicious JavaScript code by typing it in the text box and submitting. You need to configure the page to prevent JavaScript code from being submitted by the text box. In the @ Page directive, which attribute should you set to true?()
    A

    the EnableEventValidation attribute

    B

    the ResponseEncoding attribute

    C

    the ValidateRequest attribute

    D

    the Strict attribute


    正确答案: D
    解析: 暂无解析