Click here to Skip to main content
15,745,232 members
Please Sign up or sign in to vote.
1.22/5 (2 votes)
See more:
hi I have a FileUpload control and dropdown. when the drop down is selected, the file name in the FIleUpload control is lost due to postback.
How can I retain the value of FileUpload control after postback. please help ASAP

the headless nick 10-Aug-11 5:18am    
Have you tried ViewState or something and is your DDL necessary tb be AutoPostBack(ed)..

Plz Clarify your scenario lil' bit more
krishnaMurali 11-Aug-11 8:30am    
I found solution :).. thanks for fast response

AFAIK, you cannot retiain the value after postback.
Share this answer
Place the Dropdownlist in update panel, it will work
Share this answer
I used session to solve this
in Page_load assign the Fileupload to session


and when you wish just assign the session to fileupload.

Eg: in submit button click event

if (Session["abc"] != null && Session["abc"].ToString()!="")
            filUpld= (FileUpload)Session["abc"];

then use filUpld as usual
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