title: Multiple levels of UserControls using UpdatePanels
body: <p>Because we will have a bigish team of people working on various parts of pages etc I decided to break down as many of the sections of the pages into reusable Usercontrols.</p>
  
  <p>I am however having an issue with one control.</p>
  
  <p>Firstly, let me give you an idea of what is happening. You can also see this at <a href="http://www.elycity.co.uk/Business/BusinessNew2.aspx?businessid=24" rel="nofollow">http://www.elycity.co.uk/Business/BusinessNew2.aspx?businessid=24</a></p>
  
  <p>We Firstly have the layout page: BusinessNew2.aspx</p>
  
  <p>Each section has a webcontrol but the last section. The CompanyInformation Section has several other UserControls within.</p>
  
  <p>All are working fine except the Contact (businesscontact.ascx)</p>
  
  <p>On clicking the button, the Tabs.ascx is reset and it returns to the Information.ascx Tab.</p>
  
  <p>BusinessContact.ascx</p>
  
  <pre><code>&lt;%@ Control Language="VB" AutoEventWireup="false" CodeFile="BusinessContact.ascx.vb"     Inherits="BusinessListing.BusinessContact" %&gt;
  &lt;asp:UpdatePanel ID="updMain" runat="server" &gt;
  &lt;ContentTemplate&gt;
  &lt;asp:Panel ID="pnlContactMain" runat="server" &gt;
      &lt;h3&gt;Send &lt;asp:literal ID="litCompanyName" runat="server" /&gt; a message&lt;/h3&gt;
      &lt;div class="form-horizontal"&gt;
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="inputName"&gt;Name&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;asp:textbox type="text" id="txtName" placeholder="Name" runat="server" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="inputEmail"&gt;Email&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;asp:textbox id="txtEmail" placeholder="Email" runat="server" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="inputPhone"&gt;Telephone No&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;asp:textbox id="txtPhone" placeholder="Telephone" runat="server" /&gt;
              &lt;/div&gt;
          &lt;/div&gt; 
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="inputMessage"&gt;Message&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;asp:TextBox Height="40" TextMode="MultiLine" id="txtMessage" placeholder="Message" runat="server" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="inputMessage"&gt;&lt;/label&gt;
              &lt;div class="controls"&gt;
                  &lt;asp:Button ID="btnSendMessage" runat="server" Text="Send Message" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
      &lt;/div&gt;
      &lt;/asp:Panel&gt;
  
  
      &lt;asp:Panel ID="pnlContactSent" runat="server" Visible="false"&gt;
          &lt;div class="hero-unit"&gt;
              &lt;h2&gt;Email has been sent&lt;/h2&gt;
          &lt;/div&gt;
      &lt;/asp:Panel&gt;
  &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Just while testing, the codebehind:</p>
  
  <pre><code>Namespace BusinessListing
  Partial Class BusinessContact
      Inherits System.Web.UI.UserControl
  
      Protected Sub btnSendMessage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMessage.Click
          pnlContactMain.Visible = False
          pnlContactSent.Visible = True
      End Sub
   End Class
  End Namespace
  </code></pre>
  
  <p>So what am i missing. Why is this doing full postback to parent controller and how can i prevent this?</p>
  
  <p>Regards
  Mark</p>