title: How to Maintain FileUpload Control’s State after PostBack
body: <p>I have got multiple Update Panels(asp:UpdatePanel) and in each of those update panels data is inserted and shown in the corresponding grids(grids too include in update panels).
  <br/>
  I have the problem that I have a asp:FileUpload Control which is reset when data is inserted in those update panels since few controls have <b>AutoPostBack="true"</b>.
  <br/>
  I have found one of the closer solution at:- 
  <br/>
  <a href="http://www.codeproject.com/Tips/101834/How-to-Maintain-FileUpload-Control-s-State-after-P" rel="nofollow">http://www.codeproject.com/Tips/101834/How-to-Maintain-FileUpload-Control-s-State-after-P</a>
  <br/></p>
  
  <pre><code>        if (Session["FileUpload1"] == null &amp;&amp; theFile.HasFile)
          {
              Session["FileUpload1"] = theFile;
              lblStatus.Text = theFile.FileName;
          }
          else if (Session["FileUpload1"] != null &amp;&amp; (!theFile.HasFile))
          {
              theFile = (FileUpload)Session["FileUpload1"];
              lblStatus.Text = theFile.FileName;
          }
          else if (theFile.HasFile)
          {
              Session["FileUpload1"] = theFile;
              lblStatus.Text = theFile.FileName;
          }
  </code></pre>
  
  <p><br/>
  But this solution is not resolving my problem. Unfortunately all these three if-else checks are not passing the condition.
  <br/>
  I guess that there is some issue related to the UpdatePanel used in parallel with FileUpload control.
  <br/>
  I have searched a lot of articles, but it could not find the resolution. Kindly help me in this regards at earliest.</p>