I made a simple page with an ig:WebUpload control, a couple of dropdown lists, and some radio buttons. I have the uploader set to upload as a memory stream.
The idea is that a user will select which file they are submitting, whether they want to replace or update their data, then upload a CSV file and I will process it differently depending on which options they choose.
The problem is that no matter what options are chosen, either by dropdown or by radio button, inside the UploadFinishing event the dropdown lists show selected index of 0 and none of the radio buttons report as being selected. Once the UploadFinishing event is complete all of the controls show the correct options selected.
I've tried adding a hidden label or hidden field that will get a value when a radio button or a dropdown list is clicked. The value does write to the hidden field, but once I'm inside the UploadFinishing code that hidden label or field is blank.
Is there some way for me to read controls on my page as the upload is finishing up?
My sample project is attached. Please tell me what I'm doing wrong.
Hello Matt,
When you are using WebUpload1_UploadFinishing event and trying to get the status of the other control it is showing that controls are not been set and it is expected behavior because while uploading the file there is no post back happen and the status of the other controls are not being set.
Therefore, to get the status of the other controls while uploading a file you could use client side event and create a post back. To get the client side event you can refer the below link:https://es.infragistics.com/help/aspnet/webupload-using-client-side-events
Please let me know if the provided approach would help to achieve your requirement.
I'm not exactly certain how this would work.
I added a second FIleUpload control to the page and set this one to call the Javascript client function (I tried FileSelected, FileUploading, and FileUploaded)
In that function I have it read the dropdown lists and radio buttons and it does capture the correct info. I then have it do a page postback. But by the time it gets to the Server-Side fileUploading handler the controls are back to their default values again.
I need to read the file in as a memory stream, convert that to a string, process it, and then insert the results into a database. I can't do all of that through javascript, so at some point I need to run the server-side code to actually process the file, and I need to process it differently depending on what options were selected by the user.
Hello ,
We have added a functionality that helps you implement sending information from client to the server when uploading file very easy. Please check this forum thread -
https://es.infragistics.com/community/forums/t/97226.aspx
We have implemented saving file in FileStream as well. It allows you to save file in FileStream while uploading - and you could save it directly in database ,
for that please go through the below link.
https://www.igniteui.com/help/igupload-saving-files-as-stream
Please let me know if you need further information.
Thank you for the sample project.
I can in fact read the controls in the this button click event, which is great, but I do not have access to the FileStream data at this point. I am trying to save the file as a Stream, process it, and update database values without having to write out a physical file on the server, then read that, and then delete it.
So in Button click I can read the control values but not the FileStream, in UploadFinishing I can get the FileStream but cannot read the controls. How can I do both?
For Your reference I have created a sample application of webUpload using version 16.2.In the sample I am using ‘FileUploaded’ client side event to make a post back by button click. On button click you can find the updated value of all the controls.
Your code would be like this :
protected void btnClick_Click(object sender, EventArgs e) { var dd1= WebDropDown1.SelectedValue ; var text = txtTest.Text;
string c = string.Empty;
if (rbtnActivity.Checked) { c = rbtnActivity.Text; } else if (rbtnDegree.Checked) { c = rbtnDegree.Text; } else if (rbtnMajor.Checked) { c = rbtnMajor.Text; } else { c = "No Radio button selected"; }
}
Please find the attachment and let me know if you need further assistance.