Which two actions should you perform?

You use the following declaration to add a Web user control named TestUserControl.ascx to an
ASP.NET page named TestPage.aspx.
<uc:TestUserControl ID=”testControl” runat=”server”/>
You add the following code to the code-behind file of TestPage.aspx.
Private Sub TestMethod()
End Sub
You define the following delegate.
Public Delegate Sub MyEventHandler()
You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and
attach the pages TestMethod method to the event. Which two actions should you perform? (Each
correct answer presents part of the solution. Choose two.)

You use the following declaration to add a Web user control named TestUserControl.ascx to an
ASP.NET page named TestPage.aspx.
<uc:TestUserControl ID=”testControl” runat=”server”/>
You add the following code to the code-behind file of TestPage.aspx.
Private Sub TestMethod()
End Sub
You define the following delegate.
Public Delegate Sub MyEventHandler()
You need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx and
attach the pages TestMethod method to the event. Which two actions should you perform? (Each
correct answer presents part of the solution. Choose two.)

A.
Add the following line of code to TestUserControl.ascx.vb.
Public Event MyEvent As MyEventHandler

B.
Add the following line of code to TestUserControl.ascx.vb.
Public MyEvent As MyEventHandler

C.
Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.
<uc:TestUserControl ID=”testControl” runat=”server”
OnMyEvent=”TestMethod”/>

D.
D. Replace the TestUserControl.ascx reference in TestPage.aspx with the following declaration.
<uc:TestUserControl ID=”testControl” runat=”server”
MyEvent=”TestMethod”/>

Explanation:

CHAPTER 7 Creating Custom Web Controls
Lesson 1: Creating User Controls
Defining User Control Events (page 333-337)



Leave a Reply 0

Your email address will not be published. Required fields are marked *