So far, I like the WebUpload control. Very sharp.
I want to allow the user to upload an Excel file, use the Infragistics.Documents.Excel library to read the file, and then display the first worksheet in a WebDataGrid.
The file is uploading correctly to the Uploads folder, and I have code in the but the server-side WebUpload1_UploadFinished event, but no postback occurs when the upload completes. The server-side events appear to not be firing at all.
Am I missing something fundamental here? I can't find any documentation on the server events.
Also, it would be super if the "saving to disk" step could be avoided altogether, and just pass the filestream as an argument to the UploadFinished event. That would be ideal.
Hi Rob,
First please confirm that you are using jquery for ASP.net(I am just asking this question so I could be more helpful in your concrete situation). Also event UploadFinished is fired when the upload is finished and the file is uploaded as you know. Meantime probably the page is already sent from the server to the client and loaded. So my advice is to attach to client-side event fileUploaded and to make request to the server to get information about first worksheet(or you want). Server-side event UploadFinished you can use to analyze and process information from the excel file (e.g. using Infragistics.Documents.Excel library) and to return to the client in format as you want(usually JSON). One possible solution is to save this information into the session (it depends of how big the information is, what exactly the load is). I just give you an example how you can achieve this task.As this process(for processing and analyzing the information from the excel file) can take some time you can make request(to get server-side information for the first worksheet) after some timeout. For instance in the event handler for client-side event - "fileUploaded" you can make request after some time interval - e.g. 1000 miliseconds. If the file is not processed yet the server can return some error status and this request could be make after another time interval - 500 ms for instance. Of course you should have implemented logic in your server which returns this information.
I hope this information will be helpful for you.
Thanks for using our controls,
Miro Hristov
To reply, I am using jQuery for ASP.Net. I am not using MVC. This is hosted in a .aspx page.
I believe a variation of your logic can be implemented with the CSOM UploadFinished event, an UpdatePanel, and a Timer control. If I put the spreadsheet in session state, I can check session state on the timer tick event (server side), and then set the datasource for the WebDataGrid.
Hypothetically it should work... going to give it a shot! If it works, I will post sample code for everyone's benefit.
Thanks, -Rob
Hello Rob,
I hope the information provide from Miro is helpful.
Were you able to handle this?
For any further questions with this matter, do not hesitate to contact us.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
I need the same sort of pattern after an upload as well but not as complicated as your situation.
For my upload I want to rename the file to a unique name on the server and then push down that unique name to the client along with the original filename. Then when the user hits save the unique file name and the original file name are saved to my database. This will prevent duplicate filename overwrites which are not desirable.
It appears that the only way to do this is to store the unique filenames in a session and then pull them to the client via ajax so the file list on the page is displayed with the file name and the list value is the unique filename.
It would be nice to be able to alter the filename in the server side UploadFinishing event and have that new name and the original name pushed down to the client as event arguments to the onFileUploaded client event. It would save me a bunch of time.
Miro,
I am very much looking forward to seeing the sample code. I can think of several places in my application where I would like to implement the upload control, but I really have to be able to have the page respond to the uploads.
Thank you very much for taking the time to do this!
-Rob
For now I will try to prepare one sample that demonstrate this. Also I hope soon we will share such sample in our sample browser.
Thanks,
I ended up giving up. This is a terrific example of a scenario where sample code could help a lot of people. I am sure I am not the only person who would like to update other elements of a ASPX page after the upload completes.