Click here to Skip to main content
15,884,962 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
protected void Page_Load(object sender, EventArgs e)
   {
       if (this.Session["FileUpload1"] == null && FileUpload1.HasFile)
       {
           this.Session["FileUpload1"] = FileUpload1;
       }
       else if (this.Session["FileUpload1"] != null && FileUpload1.HasFile)
       {
           FileUpload1 = (FileUpload)this.Session["FileUpload1"];
       }


       else  if (!IsPostBack)
       {



           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
           if (this.Session["FileUpload1"] == null && FileUpload1.HasFile)
           {
               this.Session["FileUpload1"] = FileUpload1;
           }
           else if (this.Session["FileUpload1"] != null && FileUpload1.HasFile)
           {
               FileUpload1 = (FileUpload)this.Session["FileUpload1"];
           }
           else if (FileUpload1.HasFile)
           {
               this.Session["FileUpload1"] = FileUpload1;
           }
           Bindstate();
           Bindclass();
       }
       else if (FileUpload1.HasFile)
       {
           this.Session["FileUpload1"] = FileUpload1;
       }
       else
       {
       }


   }
Posted
Comments
mrDivan 15-Jul-15 3:07am    
Good day

Please set the EnableViewState="true" on your control in your aspx page.

Kind regards
Divan
Arasappan 15-Jul-15 3:20am    
I already set but it didn't work

Place all your controls within Asp.net Update Panel. Also, in order to post the file to the server use Postback "trigger" on submit button.
 
Share this answer
 
Comments
Arasappan 15-Jul-15 3:58am    
Am also having update panel.. My problem is not postback the screen. while in ddl postpback the uploaded photo is vanished.
Sreekanth Mothukuru 15-Jul-15 4:11am    
Where is the code to display uploaded photo on the page? Set a break point to see if the method having posted file value is null or not.
Arasappan 15-Jul-15 5:08am    
value becomes null.
when page was post back at that time fileupload control will remove the file from the control so you have to change the dropdown at client side
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900