ASP fileupload - event detection

Discussion in 'Programming' started by EagleKeeper, Nov 3, 2012.

  1. EagleKeeper

    EagleKeeper Discussion Club Moderator<br>Elite Member
    Staff Member

    Oct 30, 2000
    Likes Received:
    Time find out what I am missing

    Intent is to open the equivalent of FileOpen dialog
    User selects the file name
    Selects the Open button on the file dialog
    Dialog closes

    Here is the issue

    At present, there is a pre-rendering event that happens when an additional control is selected. At this point, I know the dialog is closed because the pre-render has taken place.

    However, I want to know when the dialog is closed. I need to run some code and enable/setup additional controls on the web page at that point that were not exposed until the File selection has been made.

    Issue is mainly cosmetic formatting, but there should be some answer to this.

  2. Train

    Train Lifer

    Jun 22, 2000
    Likes Received:
    You want a server side or client side event?

    Are you still using Web Forms? I havent used them in a few years. It seems the .Net community has moved away from the concept of "events" on the server side, it was kind of a klunky mental model. Are you working on a legacy app? If not I would recommend using any of the dozen or so MVC styled frameworks. Makes it so mch easier to keep cleaner, seperated code.
  3. Markbnj

    Markbnj Elite Member <br>Moderator Emeritus

    Sep 16, 2005
    Likes Received:
    The whole idea of knowing when the dialog is closed is meaningless on the server-side. Webforms or MVC, you are getting a POST or GET from the browser, and sometime before that the user did or didn't open the dialog and specify a value for the file type input element in the form . On the client-side the file open dialog is handled by the browser when the user clicks the "browse" button next to a file type input element. If you want to know when the user closes the resulting dialog there is probably a way to catch that in javascript.