With a custom control (lets call it TwoLists) that contains two asp:DropDownList
(defined in .ascx), I create an instance of TwoLists in my unit test, to find its child lists are nothing.
Public Sub test_TwoLists()
Dim instance As TwoLists = New TwoLists()
Dim list1 As DropDownList = instance.FindControl("list1")
Dim list2 As DropDownList = instance.FindControl("list2")
Assert.IsNotNull(list1)
Assert.IsNotNull(list2)
End Sub
Why is the control not initialized with it's child controls?
Note: This control is created/intialised and works fine when being used in an .aspx and I navigate to the page.