I have a web form containing a web upload control which works fine:
<ig:WebUpload
ID="WebUpload"
runat="server"
Mode="Multiple"
AutoStartUpload="True" LabelUploadButton="Attach File"
LabelAddButton="Attach File"
onuploadfinished="WebUpload_UploadFinished"
ViewStateMode="Enabled">
</ig:WebUpload>
How do I get a list of uploaded files after the user submits the form (the page submits to itself)?I use the "onuploadfinished" event to store the filename and path into a viewstate, however after submitting the viewstate is empty (null). I have viewstate enabled throughout the entire form. Any ideas what's wrong? Is there a better way of doing this?
Hello pkarski,
This is just a follow up on the thread if you have any questions in regards to storing the list of files within Session. In the code snippet provided shows how to retrieve the list by a button click after uploading files.
Let me know if you have any questions with this matter. Thank you.
In the UploadedFinished event you can store the file names from e.Filename into Session. Here's an example provided:
protected void Page_Load(object sender, EventArgs e){ List<string> testing = new List<string>(); if (!IsPostBack) { Session["Test"] = testing; }} protected void WebUpload1_UploadFinished(object sender, Infragistics.Web.UI.EditorControls.UploadFinishedEventArgs e){ List<string> testing = (List<string>)Session["Test"]; testing.Add(e.FileName); Session["Test"] = testing;} protected void Button1_Click(object sender, EventArgs e){ var testing = (List<string>)Session["Test"];}
protected void WebUpload1_UploadFinished(object sender, Infragistics.Web.UI.EditorControls.UploadFinishedEventArgs e){ List<string> testing = (List<string>)Session["Test"]; testing.Add(e.FileName); Session["Test"] = testing;}
protected void Button1_Click(object sender, EventArgs e){ var testing = (List<string>)Session["Test"];}