I've created a templated control that has a property called ContentTemplate which is of type ITemplate. The control works great with the exception of I now have to interact with the child controls via the FindControl method.
Markup:<test:MyControl ID="testControl" runat="server"> <ContentTemplate> <asp:Label ID="testLabel" runat="server" /> </ContentTemplate> </test:MyControl>
In order to interact with the child label, testLabel, I now need to do something like this:Dim lbl As Label = CType(testControl.FindControl("testLabel"), Label) lbl.Text = "Something new!"
Is there a way to avoid this? The reason I think this is even possible is that the UpdatePanel of AJAX has a ContentTemplate property that still allows a developer to interact with the objects they create within that tag.