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?
A.
protected override void CreateChildControls()
{
Controls.Clear();
OrderFormData oFData = new OrderFormData(“OrderForm”);
Controls.Add(oFData);
}
B.
protected override void RenderContents(HtmlTextWriter writer)
{
OrderFormData oFData = new OrderFormData(“OrderForm”);
oFData.RenderControl(writer);
}
C.
protected override void EnsureChildControls()
{
Controls.Clear();
OrderFormData oFData = new OrderFormData(“OrderForm”);
oFData.EnsureChildControls();
if (!ChildControlsCreated)
{
CreateChildControls();
}//if
}
D.
protected override ControlCollection CreateControlCollection()
{
ControlCollection controls = new ControlCollection(this);
OrderFormData oFData = new OrderFormData(“OrderForm”);
controls.Add(oFData);
return controls;
}