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.
<uc:TestUserControl ID=”testControl” runat=”server”/>
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? (Each correct answer presents part of the solution. Choose two.)
A.
Add the following line of code to the TestUserControl.ascx.vb code-behind file.
Public ReadOnly Property CityName As String
Get
Return “New York”
End Get
End Property
B.
Add the following line of code to the TestUserControl.ascx.vb code-behind file.
Protected ReadOnly CityName As String = “New York”
C.
Add the following code segment to the TestPage.aspx.vb code-behind file.
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = testControl.CityName
End Sub
D.
Add the following code segment to the TestPage.aspx.vb code-behind file.
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = testControl.Attributes(“CityName”)
End Sub
Explanation:
CHAPTER 7 Creating Custom Web Controls
Lesson 1: Creating User Controls
Defining Properties in User Controls (page 337-339)
The answers are A & C
http://www.aiotestking.com/microsoft/which-two-actions-should-you-perform-517/