PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a composite custom control named MyControl.
You need to add an instance of the OrderFormData control to the MyControl control.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Protected Overrides Sub CreateChildControls()
Controls.Clear()
Dim oFData As New OrderFormData("OrderForm")
Controls.Add(oFData)
End Sub

B.
Protected Overrides Sub RenderContents(writer As HtmlTextWriter)
Dim oFData As New OrderFormData("OrderForm")
oFData.RenderControl(writer)
End Sub

C.
Protected Overrides Sub EnsureChildControls()
Controls.Clear()
Dim oFData As New OrderFormData("OrderForm")
oFData.EnsureChildControls()
If Not ChildControlsCreated Then
CreateChildControls()
End If
End Sub

D.
Protected Overrides Function CreateControlCollection() As ControlCollection
Dim controls As New ControlCollection(Me)
Dim oFData As New OrderFormData("OrderForm")
controls.Add(oFData)
Return controls
End Function


Leave a Reply