AutoPostBack combined with javascript's onBeforeUnload causes "Unspecified error"

Discussion in 'ASP .Net' started by Jonathan, Jun 14, 2006.

  1. Jonathan

    Jonathan Guest

    Hi Everyone,
    I have a problem which I've been able to reproduce with a nice and
    small test ASP.NET web application. The page sets the
    window.onbeforeunload event so that we will get an Ok/Cancel dialog box
    to prompt users before navigating away from the page. There are many
    different types of input buttons on the page (e.g. asp:Button,
    asp:ImageButton, asp:LinkButton, asp:DropDownList, asp:CheckBox) and
    most of them work fine. However, two of these controls don't work so
    well: asp:DropDownList and asp:CheckBox (both controls have the
    attribute AutoPostBack="True"). If the user clicks Cancel on the prompt
    before the page unloads, an "unspecified error" is thrown in
    javascript. Please could somebody point me in the right direction
    towards fixing my code?
    Many thanks,
    Jonathan

    P.S. I can provide the zipped source of the test project if anybody
    thinks it might help them.
     
    Jonathan, Jun 14, 2006
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.