I have a template property in my control declared as follows:
<TemplateContainer(GetType(GenericTemplateContainer)),
PersistenceMode(PersistenceMode.InnerProperty),
TemplateInstance(TemplateInstance.Single)>
Property CustomTemplate As ITemplate
In my control's Init
event I have the following:
If Me.CustomTemplate IsNot Nothing Then
Dim TemplateContainer As New GenericTemplateContainer
Me.CustomTemplate.InstantiateIn(TemplateContainer)
PlaceHolder.Controls.Add(TemplateContainer)
End If
This allows me to place controls in markup inside my template, but on a post back the controls inside the template are not holding their ViewState.
I have tried adding PersistChildren(True)
attribute to CustomTemplate property but I cannot because it's not valid.