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).
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 AutoPostBack="true".
I have found one of the closer solution at:-
http://www.codeproject.com/Tips/101834/How-to-Maintain-FileUpload-Control-s-State-after-P
if (Session["FileUpload1"] == null && theFile.HasFile)
{
Session["FileUpload1"] = theFile;
lblStatus.Text = theFile.FileName;
}
else if (Session["FileUpload1"] != null && (!theFile.HasFile))
{
theFile = (FileUpload)Session["FileUpload1"];
lblStatus.Text = theFile.FileName;
}
else if (theFile.HasFile)
{
Session["FileUpload1"] = theFile;
lblStatus.Text = theFile.FileName;
}
But this solution is not resolving my problem. Unfortunately all these three if-else checks are not passing the condition.
I guess that there is some issue related to the UpdatePanel used in parallel with FileUpload control.
I have searched a lot of articles, but it could not find the resolution. Kindly help me in this regards at earliest.