How To Call Child user Control Events on Parent Pages
<p>I have two User Controls. And one aspx page which is loading the controls. Code is given Below</p>

<p>Home.aspx:</p>

<pre><code>&lt;%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="MYApp.Home" %&gt;


&lt;asp:Panel ID="pnlTabs" runat="server"&gt;&lt;/asp:Panel&gt;
</code></pre>

<p>Home.aspx.cs:</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
  {

base.LoadUserControl(UC_Tabs, pnlTabs);

}
</code></pre>

<p>Tabs.ascx:</p>

<pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC_Tabs.ascx.cs" Inherits="MyApp.UserControls.UC_Tabs" %&gt;                        &lt;asp:Button ID="btnPhotoTab" runat="server" Text="Photos" CssClass="tab_style" style="border-right:none;"  onclick="btnPhotoTab_Click" /&gt;



&lt;asp:Panel ID="pnlPhotos" runat="server"&gt;&lt;/asp:Panel&gt;
</code></pre>

<p>Tabs.ascx.cs:</p>

<pre><code> protected void btnActivityFeed_Click(object sender, EventArgs e)
         {
             Home HomePage = (Home)this.Page;
             LoadUserControl("UC_PhotoSearch.ascx", pnlPhotos);
         }


        public Control LoadUserControl(string ControlName, Control Container)
         {
             Control UControl = null;
                            if (ControlName != null)
                 {
                     UControl = this.LoadControl("~/UserControls/" + ControlName);
                     UControl.ID = UControl.GetType().Name;
                     Container.Controls.Add(UControl);
                 }
                                   return UControl;
         }
</code></pre>

<p>UC_PhotoSearch.ascx:</p>

<pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC_PhotoSearch.ascx.cs" Inherits="MyApp.UserControls.UC_PhotoSearch" %&gt;
 &lt;input id="txtSearch" name="txtSearch" type="text" runat="server" /&gt;
 &lt;asp:Button ID="btnSearch" runat="server" Text="Search" onclick="btnSearch_Click" /&gt;
 &lt;span id="PhotoSearchedData" runat="server"&gt;&lt;/span&gt;
</code></pre>

<p>UC_PhotoSearch.ascx.cs:</p>

<pre><code>protected void btnSearch_Click(object sender, EventArgs e)
         {
             //Photo Search Code here
         }
</code></pre>

<p>The above is all my code. 
Now I am loading the Tabs control on Home page and</p>

<p>Photo search Control on Tabs control</p>

<p>Now I click on Search Button But the</p>

<p>btnSearch_Click in not firing and even the page load event is also not firing.</p>

<p>How can I able to Access the  btnSearch_Click event from home page.</p>

<p>If I used the following on Tabs control then the button click is working fine.</p>

<pre><code>&lt;%@ Register Src=”UC_PhotoSearch.ascx” TagName=”PhotoSearch” TagPrefix=”uc1″ %&gt;
 &lt;uc1:PhotoSearch ID=”PhotoSearch″ runat=”server” /&gt;
</code></pre>

<p>So what is wrong with dynamic loading of controls.</p>

<p>Please Help me</p>
