Results 1 to 6 of 6

Thread: [RESOLVED] [2005] ITemplates automatically instanciated at runtime??

Threaded View

  1. #1

    Thread Starter
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    [RESOLVED] [2005] ITemplates automatically instanciated at runtime??

    I have a class inheriting from a (web) control.
    It has 2 templates as below:

    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; }
            }
    For reference here's the DisplayContainer and LoadingContainer, just empty classes:
    Code:
    public class DisplayContainer : Control, INamingContainer
        {
    
        }
        public class LoadingContainer : Control, INamingContainer
        {
    
        }
    Nowhere in the code do i instanciate these classes.
    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?
    Last edited by SLH; Nov 24th, 2008 at 04:20 PM.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width