I have a class inheriting from a (web) control.
It has 2 templates as below:
For reference here's the DisplayContainer and LoadingContainer, just empty classes:Code:private ITemplate _DisplayTemplate = null; private ITemplate _LoadingTemplate = null; [TemplateContainer(typeof(DisplayContainer))] [PersistenceMode(PersistenceMode.InnerProperty)] [DefaultValue(null)] public ITemplate DisplayTemplate { get { return _DisplayTemplate; } set { _DisplayTemplate = value; } } [TemplateContainer(typeof(DisplayContainer))] [PersistenceMode(PersistenceMode.InnerProperty)] [DefaultValue(null)] public ITemplate LoadingTemplate { get { return _LoadingTemplate; } set { _LoadingTemplate = value; } }Nowhere in the code do i instanciate these classes.Code:public class DisplayContainer : Control, INamingContainer { } public class LoadingContainer : Control, INamingContainer { }
Dispite this, at runtime when i navigate to the page containing this control both templates display on the page (once set of controls for each template).
All examples i've seen have some sort of container control, then instanciate the templates in a runtime-created control and add them to that container control, but i've not even done that since i want to show different templates depending on different conditions.
Surely with no code to instanciate any templates there should be no markup shown for my new control (beyond maybe an empty div or something).
What am i missing?





Reply With Quote