title: ASP.NET Update Panel Not Working Inside Web User Control
body: <p>I have created a html5 canvas and javascript signature pad that I would like to implement as a web user control with an update panel to handle the button clicks. For some reason if I add the update panel and signature pad controls directly into the aspx file the auto postback events work but when I place the same code into a web user control the fields (canvas, buttons, divs, etc) appear but the auto postback no longer works. In both cases I am placing my script manager above the update panel.</p>
  
  <p>Here's my ascx code:</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="Signature_Pad.ascx.cs"     Inherits="Controls_Signature_Pad" %&gt;
  
   &lt;asp:UpdatePanel runat="server" ID="signatureUpdate"  updatemode="Conditional"&gt;
    &lt;Triggers&gt;
       &lt;asp:AsyncPostBackTrigger controlid="signatureApprove" eventname="Click" /&gt;
       &lt;asp:AsyncPostBackTrigger controlid="sigClear" eventname="Click" /&gt;
       &lt;asp:AsyncPostBackTrigger controlid="sigCancel" eventname="Click" /&gt;
    &lt;/Triggers&gt;
    &lt;ContentTemplate&gt;
          &lt;fieldset id="SignatureFieldSet" runat="server" style=" border: 1 solid black;"&gt;
         &lt;p&gt;&lt;asp:Label ID="signatureTextLabel" AutoPostBack="true"  runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/p&gt;
          &lt;div id="canvasDiv" style="height: 300px; border:0px solid #000000; "&gt;
              &lt;canvas id="canvasSignature"  style="border:1px solid #000000;"&gt;&lt;/canvas&gt;
          &lt;/div&gt;
          &lt;div id="sigButtonDiv"  style=" border:0px solid #000000;"&gt;
              &lt;br /&gt;&lt;br /&gt;
              &lt;asp:Button AutoPostBack="true" runat="server" OnClick="OnApprove" ID="signatureApprove" Text="Approve" /&gt;
              &lt;asp:Button AutoPostBack="true" runat="server" OnClick="OnClear" ID="sigClear" Text="Clear" /&gt;
              &lt;asp:Button AutoPostBack="true" runat="server" OnClick="OnCancel" ID="sigCancel" Text="Cancel" /&gt;
          &lt;/div&gt; 
      &lt;/fieldset&gt;
   &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Here's my ascx code behind:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class Controls_Signature_Pad : System.Web.UI.UserControl
  {
  private string signatureData;
  private string signatureText;
  
  public string SignatureData
  {
      get { return signatureData; }
      set { signatureData = value; }
  }
  public string SignatureText
  {
      get { return signatureText; }
      set { signatureText = value; }
  }
  
  public void OnApprove(object sender, EventArgs e)
  {
      UtilityClass.showMessageBox("Approve Clicked", this);
      SignatureText = "Approved Clicked";
  }
  public void OnClear(object sender, EventArgs e)
  {
      UtilityClass.showMessageBox("Clear Clicked", this);
      SignatureText = "Clear Clicked";
  }
  public void OnCancel(object sender, EventArgs e)
  {
      UtilityClass.showMessageBox("Cancel Clicked", this);
      SignatureText = "Cancel Clicked";
  }
  
  public void Page_Load(object sender, EventArgs e)
  {
      signatureTextLabel.Text = signatureText;
  }
  }
  </code></pre>
  
  <p>Here's my relevant aspx:</p>
  
  <pre><code>...
  &lt;%@ Register TagPrefix="mjt" TagName="SignaturePad" Src="~/Controls/Signature_Pad.ascx" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"&gt;
  
  &lt;asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" EnablePageMethods="true"&gt;&lt;/asp:ScriptManager&gt;
   &lt;mjt:SignaturePad ID="SignaturePad" runat="server" Visible="true" SignatureData="" SignatureText="Test Signature Test." /&gt;
  
  ...
  </code></pre>