Hi!
I need to use an AjaxUploader as part of a DetailsView. Users need to enter information and choose the file they want to upload (I have ManualStartUpload set to true) before trying to insert the new record.
I have a couple of problems, though.
1) I need to be able to validate that they have selected a file. I haven't been able to find any members or properties on the Uploader that would let me do this. The validation really needs to happen server side, so a JavaScript-only solution isn't a fix (although JavaScript for a client-side check would be fine).
2) I'm not sure how to manually start the upload once they've entered all of the information.
I had 2 different ideas on how to set up my form:
The first was to hook the OnClick event for the button I'm using as the upload (InsertButton) button on the uploader. Unfortunately, all OnClick events seem to be ignored, and I wouldn't know how to stop the Browse file dialog from starting while I validate (stopping the browse file dialog from opening if they hadn't filled in all info), then manually start that dialog later after validating.
My second idea (which is probably a better idea than the first anyway) was to set ManualStartUpload to false and use the Insert button (or really, a generic button with a command works too) for the DetailsView. The problems I have with this way are: I need a way to validate that they have selected a file (with the proper extension) using the upload control, and then I need to be able to call a method to start the upload. I'll probably have to use the FileUploaded event to insert the rest of the information into the database since I'm not sure how the insert command would interact with the Uploader (I would suspect that the insert command wouldn't wait for the uploader to finish, thus causing a partially uploaded file).
I really need for this information to be entered to the database and the file to be uploaded at the "same time" for the user, meaning all information should be correct on the form and they should have the file they want uploaded picked. If there's a better way of doing this, I'd be open to hearing that as well.
Thanks!