Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1039951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:09:49+00:00 2026-05-16T15:09:49+00:00

I have just written a Word Document creation web application using .NET 3.5 which

  • 0

I have just written a Word Document creation web application using .NET 3.5 which uses XML from a SQL backend and XSL-T stylesheets to transform word xml documents as templates into letters for users to send to clients. Everything is working well and I’m pleased with the result, xslcompiledtransform is super fast even with bloated word xml documents :0) . The only problem I have is that this application is launched in a modal IE dialog from an older .NET 1.1 application and the client wants the user to be conditionally prompted before closing of the modal dialog.

Once the user has invoked the generation process a partial post back event is fired and the list of documents is displayed in a list view in an update panel, when they click on the name of a document the document is served to them and IE shows the download dialog and another partial postback updates the listview with a green tick to indicate the user has requested that document.

The client requested that if the user attempted to close the dialog before all the documents are requested then the user is prompted with a confirm option of OK and Cancel.I implemented this fine with an actual “Close” button on the form which shows a conform popup and if the user clicks OK then the window is closed with a javascript hack. The problem comes if the user decides to click the standard window x button. I managed to use the IE approach of adding the onunload event to the body and returning a string with a custom message like Microsoft CRM uses but this no where near ideal for a couple of reasons.

Firstly it is ugly as hell and I don’t like the standard uncontrollable additional message that comes with this functionality. Also the main problem I have is that this is being caused with every partial post back which is understandable but bloody annoying and even if no documents have been generated or they have and all have been requested.

So finally my question is: Can I either ideally somehow trick IE into cancelling the closure in onunload with using the standard javascript confirm using my own function containing the simple logic, maybe with an Iframe or such like? Or add some logic to when the standard IE popup appears?

I know this is standard functionality and it’s there for a good security reason but it is what the client really wants and this is not a public facing site, it is only used internally within their company.

Many Thanks in advance and sorry for the waffle but just wanted to make sure I gave as much details as possible because I antipicated the initial questions of “Why?”.

Paul

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:09:49+00:00Added an answer on May 16, 2026 at 3:09 pm

    With the release looming and nobody prepared to sift through my waffle I went with the standard IE onbeforeunload event. In my js i had:

    window.onbeforeunload = PromptUserToClose
    
    function PromptUserToClose()
      if(!allDownloaded){
         return "Are you sure....."
      }
    

    The problem though was I had LinkButtons in my update panel which were causing PartialPost backs which IE for some reason beleived was an unload of the window so to get around it I changed them to asp:Hyperlinks and then added a javascript postback call from server side using Page.ClientScript.GetPostBackEventReference(Me, "MyCustomArgument"). This did the job.

    Thanks

    Paul

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small I have just written which uses the following uri template.
I have just re-written the authentication for one of our internal web applications to
I've written an XML parser in Python and have just added functionality to read
I have written a SQL query that works just fine, but am having a
I have written a simple WCF web service which is configured programmaticaly. It exposes
I have a Windows Workflow application that uses classes I've written for COM automation.
I have just written a small piece of code and it struck me that
I have written a small program just like hello the world , everything was
I have written a following code to get just the file name without extension
I have written a function that positions a tooltip just above a textbox. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.