Confirm from code behind

Discussion in '.NET' started by mbailey, Jul 1, 2017.

  1. mbailey

    mbailey

    Joined:
    Jul 1, 2017
    Messages:
    1
    Likes Received:
    0
    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.
     
    mbailey, Jul 1, 2017
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    956
    Alphonse Giambrone
    Jun 28, 2003
  2. Daniel Manes

    Code-Behind Pain in the Behind!

    Daniel Manes, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    1,053
  3. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    856
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
  4. tshad
    Replies:
    3
    Views:
    8,229
    elizas
    Mar 25, 2010
  5. alxcam8
    Replies:
    0
    Views:
    701
    alxcam8
    Jun 29, 2016
  6. Ankit Tayal
    Replies:
    0
    Views:
    1,129
    Ankit Tayal
    Oct 1, 2016
  7. Manqoba
    Replies:
    0
    Views:
    443
    Manqoba
    Nov 14, 2016
  8. QuarterOunce
    Replies:
    0
    Views:
    184
    QuarterOunce
    Mar 5, 2017
Loading...