title: File upload not in Update panel hasfile coming false even if file is present in asp.net
body: <blockquote>
    <p>i am trying to upload the file but all the time <code>hasfile</code> is coming
    <code>false</code>. why file upload control is also not in update panel
    i have even check file is not empty as pointed by other answers in stackoverflow.</p>
  </blockquote>
  
  <p><strong>.aspx file</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;asp:Label ID="AddDoc_SelectHeadLabel" runat="server" Text="Select File:" AssociatedControlID="file"&gt;&lt;/asp:Label&gt;
  
      &lt;asp:FileUpload ID="file" runat="server" CssClass="form-control" /&gt;
  
  &lt;/div&gt;
  &lt;div class="text-right"&gt;
      &lt;asp:ValidationSummary ID="vs1" runat="server" ValidationGroup="DocumentvalGroup" ShowSummary="false" ShowMessageBox="false" /&gt;
      &lt;button type="button" class="btn btn-primary btn-sm" id="AddDoc_SaveButton" runat="server" validationgroup="DocumentvalGroup"&gt;&lt;i class="fa fa-upload"&gt;&lt;/i&gt;&amp;nbsp;Upload&lt;/button&gt;
      &lt;button type="button" id="cancelButton" runat="server" class="btn btn-default btn-sm btn-leftspace" style="display:none;"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&amp;nbsp;Cancel&lt;/button&gt;
      &lt;Triggers&gt;
          &lt;asp:PostBackTrigger ControlID="AddDoc_SaveButton" /&gt;
      &lt;/Triggers&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>C# code</p>
  
  <pre><code>protected void btnSave_Click(object sender, System.EventArgs e)
  {
      try {
          if (Session["CheckRefresh"].ToString() == ViewState("CheckRefresh").ToString()) {
              if (file.HasFile) {
              }
          }
      }
  }
  </code></pre>