Maintain state of Fileupload control
How can I maintain state of fileupload control in asp.net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prasenjit DeyPosted Oct 7, 2013, 1:31 AM
Jaganathan BantheswaranPosted Oct 6, 2013, 1:34 AM
You have to use Session. Try like this,
if (Session["FileUpload1"] == null && FileUpload1.HasFile)
{
Session["FileUpload1"] = FileUpload1;
}
else if (Session["FileUpload1"] != null && (! FileUpload1.HasFile))
{
FileUpload1 = (FileUpload) Session["FileUpload1"];
}
else if (FileUpload1.HasFile)
{
Session["FileUpload1"] = FileUpload1;
}