title: ASP.NET Update Panel with CheckBox - Not Working Properly
body: <p>I'm working on a simple demo project so that I can learn some things about ASP.NET's AJAX capabilities.  My problem is that I can't seem to get an UpdatePanel to work properly with a CheckBox inside of it.  Here is the markup I'm using in my .aspx file:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="UpdatePanel.aspx.cs" Inherits="Testing.UpdatePanel" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;style type="text/css"&gt;
              td
              { 
                  font-family:Arial;
                  font-size:10pt;
              } 
              #mainTable
              {
                  background-color:#e3f3ff;
                  border:3px;
                  border-color:#000000;
                  border-style:solid;
              }
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
              &lt;div&gt;
                  &lt;center&gt;
                      &lt;table id="mainTable"&gt;
                          &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
  
                          &lt;asp:ScriptManager ID="SM1" runat="server" /&gt;
                          &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt;
                              &lt;ContentTemplate&gt;
                                  &lt;tr&gt;
                                      &lt;td&gt;&lt;asp:CheckBox ID="chkPaypal" runat="server" Text="Paypal" OnCheckedChanged="PayPal_CheckedChanged" AutoPostBack="true" /&gt;&lt;/td&gt;
                                  &lt;/tr&gt;
                                  &lt;asp:Panel ID="pnlPayPal" runat="server" Visible="false"&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;asp:Label runat="server" ID="lblPaypalEmail" Text="Email:" /&gt;&lt;/td&gt;
                                          &lt;td&gt;&lt;asp:TextBox runat="server" ID="tbPaypalEmail" Text="" Width="250px" /&gt;&lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                                  &lt;/asp:Panel&gt;
                              &lt;/ContentTemplate&gt;
                              &lt;Triggers&gt;
                                  &lt;asp:ASyncPostBackTrigger ControlID="chkPayPal" /&gt;
                              &lt;/Triggers&gt;
                          &lt;/asp:UpdatePanel&gt;
                          &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td colspan="2"&gt;
                                  &lt;center&gt;
                                      &lt;asp:Button ID="btnRegister" runat="server" onclick="btnRegister_Click" 
                                          Text="Register" Height="30px" Width="80px" /&gt;
                                  &lt;/center&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/center&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In my code behind, I have:</p>
  
  <pre><code>using System;
  
  namespace Testing
  {
      public partial class UpdatePanel : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
  
          }
  
          protected void btnRegister_Click(object sender, EventArgs e)
          {
  
          }
  
          protected void PayPal_CheckedChanged(object sender, EventArgs e)
          {
              pnlPayPal.Visible = chkPaypal.Checked;
          }
      }
  }
  </code></pre>
  
  <p>Instead of making the panel visible as I anticipate, it is adding another "PayPal" checkbox at the top of the page.  Any ideas?</p>