title: ASP.NET Controls in UpdatePanel not working after File Upload
body: <p>I'm new to working with the AJAX UpdatePanel and I've tried searching for an answer to this question and haven't found a solution yet.</p>
  
  <p>I have multiple controls in an UpdatePanel since I am hiding and showing panels based on different button clicks. Also inside the UpdatePanel is a FileUpload control. Everything works fine until I upload a file. After that, none of the controls, like buttons or radio button lists, or JQuery scripts, like a datepicker, fire in the UpdatePanel after the upload.</p>
  
  <p>Here is the aspx code:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="Site.Admin" %&gt;
  &lt;%@ MasterType  virtualPath="~/Site1.master"%&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
  
          &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt; 
          &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"&gt;&lt;/script&gt;
  
          &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css"&gt;
          &lt;script src="//code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
          &lt;script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="scripts/jquery-ui-timepicker-addon.js"&gt;&lt;/script&gt;
          &lt;link rel="stylesheet" href="Content/jquery-ui-timepicker-addon.css"&gt;
  
      &lt;script type="text/javascript"&gt; 
          function pageLoad() { 
              $(function () { 
                  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
  
                  function EndRequestHandler(sender, args) {
                      $('.picker').datetimepicker();
                  }
              }); 
          } 
      &lt;/script&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True"&gt;&lt;/asp:ScriptManager&gt;
              &lt;asp:UpdatePanel ID="adminUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="True" runat="server"&gt;
                      &lt;ContentTemplate&gt;
  
                  &lt;div class="form-group"&gt;
                                      &lt;div class='input-group date' id='datetimepicker3'&gt;
                                          &lt;asp:TextBox ID="tb_EndDate" class="form-control picker" runat="server"&gt;&lt;/asp:TextBox&gt;
                                          &lt;span class="input-group-addon"&gt;
                                                  &lt;span class="glyphicon glyphicon-calendar"&gt;&lt;/span&gt;
                                          &lt;/span&gt;
                                      &lt;/div&gt;
                              &lt;/div&gt;
  
                              &lt;div class="form-group"&gt;
                                      &lt;asp:RadioButtonList ID="rbl_Active" runat="server" OnSelectedIndexChanged="rbl_Active_SelectedIndexChanged" RepeatDirection="Horizontal" CellPadding="4" CellSpacing="4" AutoPostBack="True"&gt;
                                          &lt;asp:ListItem&gt;Yes&lt;/asp:ListItem&gt;
                                          &lt;asp:ListItem&gt;No&lt;/asp:ListItem&gt;
                                      &lt;/asp:RadioButtonList&gt;
                              &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                                      &lt;label&gt;Upload Photo&lt;/label&gt;
                                          &lt;asp:FileUpload ID="imageFileUpload" runat="server" /&gt;                                    
                                          &lt;asp:Button class="btn btn-primary" ID="btn_UploadImg" runat="server" Text="Upload Image" OnClick="btn_UploadImg_Click" CausesValidation="False" /&gt;
                                          &lt;asp:Button ID="btn_CancelImg" OnClick="btn_CancelImg_Click" class="btn btn-primary" runat="server" Text="Change/Remove Image" CausesValidation="False" /&gt;
                              &lt;/div&gt;
              &lt;/ContentTemplate&gt;
              &lt;/asp:UpdatePanel&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>And the code behind relating to the file upload:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
          {
              ScriptManager.GetCurrent(this).RegisterPostBackControl(this.btn_UploadImg);
          }
  
  protected void btn_UploadImg_Click(object sender, EventArgs e)
          {
              bool isUploaded = uploadImage(imageFileUpload);
              if (isUploaded)
              {                
                  btn_CancelImg.Visible = true;
  
              }
          }
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong. It worked fine when run from Visual Studio, but when pushed to the server it all fails</p>