更多"You create a Web Form. The Web Form"的相关试题:
[单项选择]You create a Web Form. The Web Form allows users to calculate values and display the results in a label named lblResults. You need to capture all unhandled exceptions on the Web Form through the Error event. The Error event must capture each unhandled exception and display it on the Web Form. Which code segment should you use? ()
A. Protected Sub Page_Error(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Error lblResults.Text = e.ToString() e = NothingEnd Sub
B. Protected Sub Page_Error(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Error lblResults.Text = Server.GetLastError().ToString() Server.ClearError()End Sub
C. Protected Sub Page_Error(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Error Response.Write(e.ToString()) e = NothingEnd Sub
D. Protected Sub Page_Error(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Error Response.Write(Server.GetLastError().ToString()) Server.ClearError()End Sub
[单项选择]You create a Web Form that allows users to create a new account. You add a CreateUserWizard control by using the following code segment. You need to ensure that the wizard automatically sends an e-mail message to users when they finish creating their accounts. You add a valid element to the Web.config file. Which code segment should you add to the Page_Load event? ()
A. Wizard1.RequireEmail = True
B. Wizard1.Email = "user@address.com"
C. Wizard1.MailDefinition.From = "registration@mysite.com"
D. SmtpMail.SmtpServer = "mail.contoso.com"
[多项选择]You create a Web Form. The Web Form contains two Web Parts named CustomerPart and OrdersPart. CustomerPart contains a drop-down list of customers. OrdersPart contains a list of orders that a customer has placed. You need to create a static connection between CustomerPart and OrdersPart. When a user selects a customer from CustomerPart, OrdersPart must update. Which four actions should you perform? ()
A. Add the ConnectionProvider attribute to OrdersPart.
B. Add the ConnectionProvider attribute to CustomerPart.
C. Add the ConnectionConsumer attribute to CustomerPart.
D. Add the ConnectionConsumer attribute to OrdersPart.
E. Add OrdersPart and CustomerPart to the WebParts directory.
F. Add OrdersPart and CustomerPart to the App_Code directory.
G. Declare the connections within a StaticConnections subtag of a WebPartZone class.
H. Declare the connections within a StaticConnections subtag of a WebPartManager class.
I. Define an interface specifying the methods and properties that are shared between the Web Parts.
[单项选择]You create a Web Form. The Web Form uses the FormView control to enable a user to edit a record in the database. When the user clicks the Update button on the FormView control, the application must validate that the user has entered data in all of the fields. You need to ensure that the Web Form does not update if the user has not entered data in all of the fields. Which code segment should you use? ()
A. Protected Sub FormView1_ItemUpdating(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) _ Handles FormView1.ItemUpdating Dim entry As DictionaryEntry For Each entry In e.Keys If entry.Value.ToString() = System.String.Empty Then e.Cancel = True Return End If Next entryEnd Sub
B. Protected Sub FormView1_ItemUpdated(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs) _ Handles FormView1.ItemUpdated Dim entry As DictionaryEntry For Each entry In e.NewValues If entry.Value.Equals("") Then e.KeepInEditMode = True Return End If Next entryEnd Sub
C. Protected Sub FormView1_ItemUpdating(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) _ Handles FormView1.ItemUpdating Dim entry As DictionaryEntry For Each entry In e.NewValues If entry.Value.Equals("") Then e.Cancel = True Return End If Next entryEnd Sub
D. Protected Sub FormView1_ItemUpdated(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs) _ Handles FormView1.ItemUpdated Dim entry As DictionaryEntry For Each entry In e.Keys If entry.Value.ToString() = System.String.Empty Then e.KeepInEditMode = True Return End If Next entryEnd Sub
[单项选择] You are creating a Web Form. The Web Form allows users to rename or delete products in a list. You create a DataTable named dtProducts that is bound to a GridView. DataTable has the following four rows. dtProducts. Rows(0)("ProductName") = "Soap"dtProducts. Rows(1)("ProductName") = "Book"dtProducts. Rows(2)("ProductName") = "Computer"dtProducts. Rows(3)("ProductName") = "Spoon"dtProducts. AcceptChanges( ) The user utilizes a Web Form to delete the first product. You need to set the RowStateFilter property of the DataTables DefaultView so that only products that have not been deleted are shown. To which value should you set the DataTabless DefaultView.RowStateFilter?()
A. Data View Row State.Modified Original
B. Data View Row State.Modified Current
C. Data View Row State.Current Rows
D. Data View Row State.Added
[单项选择] You want to enable users of a Web application to modify the Web application's UI and behavior. These modifications must be maintained at the user level so that when users return to the Web application, the changes are still in effect. You need to achieve this goal by using the minimum amount of custom code. What should you do?()
A. Persist control data by using view state.
B. Use Web Part controls.
C. Maintain a profile for each user.
D. Enable session state on the Web application.
[多项选择]You create a Web Form that contains connected Web Parts. You write the following declaration in your Web Form.You need to ensure that your Web Part connection is valid. Which two actions should you perform? ()
A. Include a data source identified as "WebPartConnection1" on the Web Form.
B. Include a Web Part identified as "customerPart" on the Web Form.
C. Include a Web Part identified as "ordersPart" on the Web Form.
D. Ensure that you declare an interface named "IOrdersPart".
E. Ensure that you declare an interface named "ICustomerPart".
F. Ensure that each Web Part declares either a GetInterface or ProvideInterface method.
[多项选择]You are creating a Web Form. You write the following code segment to create a SqlCommand object. SqlConnection conn = new.SqlConnection(connString); conn.Open( ); SqlCommand cmd = conn.CreateCommand( ); cmd.CommandText = “select cont(*) from Customers”; You need to display the number of customers in the Customers table. Which two code segments can you use to achieve this goal? ()
A. object customerCount = cmd.ExecuteScalar();lblCompanyName.Text = customerCount.ToString();
B. int customerCount = cmd.ExecuteNonQuery();lblCompanyName.Text = customerCount.ToString();
C. SqlDataReader dr = cmd.ExecuteReader();dr.Read();lblCompanyName.Text = dr[0].ToString();
D. SqlDataReader dr = cmd.ExecuteReader();dr.Read();lblCompanyName.Text = dr.ToString();