control not found in custom template
<p>I take a user control file. I put this</p>

<pre><code>&lt;div  style="width:100%;"&gt;
    &lt;div style="width:100%;"&gt;
        &lt;asp:PlaceHolder ID="Header" runat="server" /&gt;
    &lt;/div&gt;
    &lt;div style="width:65%;float:left;"&gt;
        &lt;asp:PlaceHolder ID="LeftSide" runat="server" /&gt;
    &lt;/div&gt;
    &lt;div style="width:35%;float:right;padding-top:20px;"&gt;
        &lt;asp:PlaceHolder ID="RightSide" runat="server" /&gt;
    &lt;/div&gt;
    &lt;div style="width:100%;"&gt;
        &lt;asp:PlaceHolder ID="Footer" runat="server" /&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>In code-behind</p>

<pre><code>Imports System.ComponentModel

Partial Public Class MainTemplate
    Inherits System.Web.UI.UserControl

    Private HeaderTemplateVar As ITemplate = Nothing
    Private LeftTemplateVar As ITemplate = Nothing
    Private RightTemplateVar As ITemplate = Nothing
    Private FooterTemplateVar As ITemplate = Nothing
    Private HeaderWidthVar As Integer

    &lt;TemplateContainer(GetType(Container)), PersistenceMode(PersistenceMode.InnerProperty)&gt; _
    Public Property HeaderTemplate() As ITemplate

        Get
            Return HeaderTemplateVar
        End Get
        Set(ByVal value As ITemplate)
            HeaderTemplateVar = value
        End Set

    End Property

    &lt;TemplateContainer(GetType(Container)), PersistenceMode(PersistenceMode.InnerProperty)&gt; _
   Public Property FooterTemplate() As ITemplate

        Get
            Return FooterTemplateVar
        End Get
        Set(ByVal value As ITemplate)
            FooterTemplateVar = value
        End Set

    End Property

    &lt;TemplateContainer(GetType(Container)), PersistenceMode(PersistenceMode.InnerProperty)&gt; _
   Public Property RightTemplate() As ITemplate

        Get
            Return RightTemplateVar
        End Get
        Set(ByVal value As ITemplate)
            RightTemplateVar = value
        End Set

    End Property

    &lt;TemplateContainer(GetType(Container)), PersistenceMode(PersistenceMode.InnerProperty)&gt; _
    Public Property LeftTemplate() As ITemplate

        Get
            Return LeftTemplateVar
        End Get
        Set(ByVal value As ITemplate)
            LeftTemplateVar = value
        End Set

    End Property

    Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

        If Not HeaderTemplate Is Nothing Then

            Dim HeaderContainer As New Container()
            HeaderTemplate.InstantiateIn(HeaderContainer)
            Header.Controls.Add(HeaderContainer)

        End If

        If Not LeftTemplate Is Nothing Then

            Dim LeftContainer As New Container()
            LeftTemplate.InstantiateIn(LeftContainer)
            LeftSide.Controls.Add(LeftContainer)

        End If

        If Not RightTemplate Is Nothing Then

            Dim RightContainer As New Container()
            RightTemplate.InstantiateIn(RightContainer)
            RightSide.Controls.Add(RightContainer)

        End If

        If Not FooterTemplate Is Nothing Then

            Dim FooterContainer As New Container()
            FooterTemplate.InstantiateIn(FooterContainer)
            Footer.Controls.Add(FooterContainer)

        End If

    End Sub


End Class
</code></pre>

<p>When I call this in UI, I put a button on the UI page that control is not appear in code-behind of UI.
I get this button event in code-behind.</p>

<pre><code>&lt;Yoma:Template ID="Test1" runat="server"&gt;
        &lt;HeaderTemplate&gt;
            &lt;div  style="background-color:Silver;color:Red;width:100%;"&gt;Welcome&lt;/div&gt;
        &lt;/HeaderTemplate&gt;
        &lt;LeftTemplate&gt;
                &lt;p&gt;he 1962 South Vietnamese Independence Palace bombing in Saigon was an aerial attack on 
                February 27, 1962, by two dissident Vietnam Air Force pilots, Second Lieutenant Nguyễn Văn 
                political association. Domestically, the incident was 
                reported to have increased plotting against Diem by his officers. (more...)&lt;/p&gt;
        &lt;/LeftTemplate&gt;
        &lt;RightTemplate&gt;
            &lt;table align="right" border="0" cellspacing="0" cellpadding="10" style="width:300px; border: 1px Solid #78bafa;" bgcolor="#f3f7fa" id="AddUser"&gt;
                &lt;tr&gt;
                    &lt;td align="left"&gt;
                        &lt;table style="width:260px;" border="0" cellspacing="0" cellpadding="3"&gt;
                            &lt;tr&gt;
                                &lt;td height="30" colspan="2" valign="top"&gt;
                                    &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
                                        &lt;tr&gt;
                                            &lt;td &gt;&lt;strong&gt;Add Respondent&lt;/strong&gt;&lt;/td&gt;
                                            &lt;td align="right"&gt;&lt;/td&gt; 
                                        &lt;/tr&gt;
                                    &lt;/table&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt; 
                            &lt;tr&gt;
                                &lt;td width="75"  &gt;First Name:&lt;/td&gt;
                                &lt;td width="185"  &gt;&lt;input name="FirstName" type="text" runat="server" id="FirstName" size="8" /&gt;&lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td  &gt;Surname:&lt;/td&gt;
                                &lt;td  &gt;&lt;input name="Surname" type="text" id="Surname" size="12" /&gt;&lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td  &gt;Email:&lt;/td&gt;
                                &lt;td  &gt;&lt;input name="Email" type="text" id="Email" size="17" /&gt;&lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td colspan="2" &gt;&lt;br /&gt;
                                    &lt;asp:Button ID="AddRespondentButton" runat="server" Text="ADD RESPONDENT" /&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                        &lt;/table&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/RightTemplate&gt;
        &lt;FooterTemplate&gt;
            &lt;table style="width:900px;margin:0px 0px 0px 0px;" border="0" align="center" cellpadding="3" cellspacing="0"&gt;
                &lt;tr&gt;
                    &lt;td &gt;&amp;copy; 2006-&lt;%=Now.Date%&gt; Easi-Answers Limited&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/FooterTemplate&gt;
    &lt;/Yoma:Template&gt;
</code></pre>
