jquery click-events after postback don't work anymore

jquery click-events after postback don't work anymore

Hi there,

I built a small website which has a confirmButton on it. When you click the confirmButton a dialog will appear which asks you to confirm or to cancel.

The problem is that after you click 'Yes' on the dialog (executes postback) the jquery-click-event on the confirmButton doesn't work anymore.

Below you can see my whole website.

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConfirmDialogTest.aspx.cs" Inherits="NeuesBerufsbildungsWeb._Global.WebControl.ConfirmDialogTest" %>

    <%@ Register src="ConfirmDialogWebUserControl.ascx" tagname="ConfirmDialogWebUserControl" tagprefix="uc1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
       
        <script src="/_Global/Javascript/jquery-1.4.1.js" type="text/javascript"></script>
        <script src="/_Global/Javascript/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>


        <script type="text/javascript">





















  2.         function loadConfirmDialog() {
                // configure dialog
                jQuery('#confirmDialog').dialog({
                    autoOpen: false,
                    width: 400,
                    modal: true,
                    resizable: false
                });

                // open dialog
                jQuery('#confirmButton').live('click', function () {
                    jQuery('#confirmDialog').dialog('open');
                    return false;
                });
                // execute postback
                jQuery('#continueButton').live('click', function () {
                    jQuery('#confrimDialog').dialog('destroy');
                    __doPostBack('confirmButton', '');
                });
                // cancel postback
                jQuery('#cancelButton').live('click', function () {
                    jQuery('#confirmDialog').dialog('close');
                    return false;
                });
            }
        </script>



























  3.         <div id="confirmDialog" title="Warning" runat="server">
                <p>
                    <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
                    <span id="messageSpan" runat="server">
                        Wollen Sie den Eintrag wirklich entfernen?
                    </span>
                    <a id="continueButton" runat="server" href="#">Yes</a>
                    <a id="cancelButton" runat="server" href="#">No</a>
                </p>
            </div>

            <asp:Button ID="confirmButton" runat="server" Text="Do postback" />

            <script type="text/javascript">













  4.             loadConfirmDialog();
            </script>
        </form>
    </body>
    </html>





I hope you can fix this problem. Any answers are greatly appreciated.