Saving data while closing a window

Discussion in 'ASP .Net' started by M B HONG 20, Nov 29, 2005.

  1. M B HONG 20

    M B HONG 20 Guest

    I am working on an ASP.NET web application (C#), and need a web form to
    either save data on a click of the "X" (Top right corner of the
    browser) or just disable the "X" altogether. I have a "Save" button
    which is tied to a C# event which saves all of my data via from
    sessions, or from the form directly etc., but i need it to save the
    data in the event that the user decides to close it with the "X". I am
    aware of the browser's native onClose property, but I am not sure if it
    can call a C# command from there, and also if it can call a C# command,
    does that C# command have access to the form's fields? Any help would
    be greatly appreciated.
    M B HONG 20, Nov 29, 2005
    #1
    1. Advertising

  2. It is unlikely that you will be able to invoke a postback when the window
    closes. Now you might be able to hook the close event in JavaScript and
    alert the user. Maybe even give them a chance to cancel the close so they
    can save their work. Ultimately this would be user error if they close the
    window with data that has not been saved.

    "M B HONG 20" <> wrote in message
    news:...
    >I am working on an ASP.NET web application (C#), and need a web form to
    > either save data on a click of the "X" (Top right corner of the
    > browser) or just disable the "X" altogether. I have a "Save" button
    > which is tied to a C# event which saves all of my data via from
    > sessions, or from the form directly etc., but i need it to save the
    > data in the event that the user decides to close it with the "X". I am
    > aware of the browser's native onClose property, but I am not sure if it
    > can call a C# command from there, and also if it can call a C# command,
    > does that C# command have access to the form's fields? Any help would
    > be greatly appreciated.
    >
    Peter Rilling, Nov 29, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    4
    Views:
    33,865
    =?Utf-8?B?U29sZWwgU29mdHdhcmU=?=
    Oct 14, 2004
  2. =?Utf-8?B?Vk1J?=

    Closing popup window when closing parent window?

    =?Utf-8?B?Vk1J?=, Feb 14, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    641
    Thomas Hansen
    Feb 15, 2007
  3. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    194
    Curt_C [MVP]
    Oct 3, 2003
  4. Eric B Venet
    Replies:
    0
    Views:
    91
    Eric B Venet
    Jul 31, 2003
  5. thomas
    Replies:
    0
    Views:
    214
    thomas
    Oct 23, 2003
Loading...

Share This Page