Confirm from code behind

Jul 1, 2017
Reaction score
I'm a client/server and database developer filling in for two web developers that just quit. I have very limited knowledge of web programming but I'm working on a program with aspx web pages and vb code behind. Here is my situation:
  • Functionality currently exists in a control in a panel on the aspx page to upload a file after validating the file information.
  • The aspx page for this control includes two text boxes for description and file path/name and an Upload button.
  • When the user clicks Upload, the vb handler for the button clicked event executes. The current code behind checks for description text, file existence, file size and, if they are valid, uploads the file. If any validation fails, a flag (bUploadValid) is set that allows the upload code to be bypassed and an alert is displayed at the end indicating either the upload outcome or a validation error.
My new task is to obtain confirmation from the user that the upload should continue when the file size is within the maximum but above 40MB.
  • I already determine the file size in the code behind to ensure it is within the maximum but the separation of client and server side does not allow me to suspend the code behind processing to get user confirmation and resume code behind processing.
  • My intended solution is to put the code that uploads the file into a separate function and add another flag variable (bConfirmUpload) to the Upload clicked handler to indicate whether user confirmation is required for the upload.
  • If the upload is valid and does not require confirmation, the handler will call the function to upload the file.
  • If the upload requires confirmation, I need to display the confirm window and, if the user chooses Yes, call the function to upload the file. If the user chooses No, no additional processing is needed.
What I need help on is how to implement the confirmation process. I cannot use OnClientClick because the file size is determined after the click. I can use ScriptManager.RegisterStartupScript but I have not found anything online that tells me exactly and completely how to do that. I tried a lot of things from online forums that I could not get to work. Can anyone provide me with a complete example of what code to add to the aspx page and the various code behind functions (vb, not c#) to implement this? Thanks in advance from a web newbie.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Latest member

Latest Threads