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); }
您可能感兴趣的试卷
你可能感兴趣的试题
You are implementing an ASP.NET application that will use session state in out-of-proc mode. You add the following code.
You need to add an attribute to the Person class to ensure that you can save an instance to session state.
Which attribute should you use?()
A.Bindable
B.DataObject
C.Serializable
D.DataContract
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;}
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;
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.%@>%@>
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()
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}"} )
A.Replace line 11 with the following code segment. context.MapRoute("product_default", "{area}/{controller}/{action}/{id}", New With {.area = "product", .controller = "Product", .action = "Index", .id = ""})
B.Replace line 11 with the following code segment. context.MapRoute("product_default", "{area}", New With {.controller = "Product", .action = "Index", .id = ""})
C.Add the following code segment at line 12. AreaRegistration.RegisterAllAreas()
D.Add the following code segment to the RegisterRoutes method in the Global.asax.vb file. AreaRegistration.RegisterAllAreas()
You are creating an ASP.NET Web site. You create a HTTP module named Custom Module, and you register the module in the web.config file.The Custom Module class contains the following code. Public Class Custom Module Implements IHttpModule
Dim footerContent As String = Footer Content"Public Sub Dispose() Implements IHttpModule.DisposeEnd SubEnd Class You need to add code to CustomModule to append the footer content to each processed ASP.NET page. Which code segment should you use?()
A.Public Sub New(ByVal app As HttpApplication) AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication) app.Response.Write(footerContent) End Sub
B.Public Sub Init(ByVal app As HttpApplication) _ Implements IHttpModule.Init AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = New HttpApplication() app.Response.Write(footerContent) End Sub
C.Public Sub New() Dim app As HttpApplication = New HttpApplication() AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication) app.Response.Write(footerContent) End Sub
D.Public Sub Init(ByVal app As HttpApplication) _ Implements IHttpModule.Init AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication)app.Response.Write(footerContent) End Sub
A.Configure the SqlMembershipProvider in the web.config file.
B.Configure the SqlProfileProvider in the web.config file.
C.Create an ASP.NET page that contains a default CreateUserWizard control to create a new user account.
D.Create an ASP.NET page that contains a custom form that collects the user information and then uses the Membership.CreateUser method to create a new user account.
A.Add the following method to the CompanyController class. Function Info() As ActionResult Return View() End Function
B.Add the following method to the CompanyController class. Function Company_Info() As ActionResult Return View() End Function
C.Right-click the Views folder, and select View from the Add submenu to create the view for the action.
D.Right-click inside the action method in the CompanyController class, and select Add View to create a view for the action
最新试题
In a page there is a div (I guess it was a div) and you need to execute a javascript function when if first moves the mouse over the element.()
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?()
You are debugging an ASP.NET Web application by using the Visual Studio debugger. The application is incorrectly handling a SQL Exception on the login page. You need to break execution where the exception is thrown . What should you do?()
Which event of the GridView class occurs when the Edit button of a row is clicked, but before the GridView control enters edit mode?()
Which class is used to specify a set of features to support on the XrnlReader object created by the Create method?()
Which control allows you to bind to data items that are returned from a data source and display them?()
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?()
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.()
Which of the following is the correct collection of build events?()
The page will be posted to the server after one or more image files are selected for upload.You need to ensure that all unuploaded files are saved to the server within one call to a single event handler. What should you do? ()