jquery Dialog reappears on postback
<p>I have a GridView with a TemplateField holding a LinkButton. When this button is clicked it converts some XML that is in another hidden TemplateField to a string and assigns it to a label in a hidden div to be used in a modal dialog. Currently the dialog opens as expected with the proper information, it closes and I can select another record in the grid to view with no problems. This is where it goes wrong and I have not been able to find a solution. If I do something else on the page that causes a postback, the last dialog box to be opened will open on the new page load.</p>

<p>Here is my relevant mark-up:</p>

<pre><code>    &lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $("#txtBeginDate").datepicker();
    $("#txtEndDate").datepicker();

    $("#response").dialog({
        autoOpen: false,
        modal: true,
        height: "auto",
        width: "auto",
        title: "Equifax Response",
        close: function(ev, ui) {
            $(this).dialog('destroy').remove();
        }
    });

    $("[id*=lnkEquifaxResponse]").on("click", function EquifaxResopnse() {
        $("#lblDialog").empty();
    });

    if ($("#lblDialog").text() != "") {
        $("#response").dialog("open");
    }
});
    &lt;/script&gt;

    &lt;div id="response" visible="false"&gt;
        &lt;asp:Label ID="lblDialog" runat="server" &gt;&lt;/asp:Label&gt;
    &lt;/div&gt;

    &lt;div id="Gridview"&gt;
        &lt;asp:GridView ID="grClientTransactions" runat="server" AllowPaging="True" 
            PageSize="25" AutoGenerateColumns="False" DataKeyNames="ResponseXML"
            EmptyDataText="Record not found." EmptyDataRowStyle-BackColor="#CCCCCC" EmptyDataRowStyle-Font-Bold="true"
            CssClass="mGrid" PagerStyle-CssClass="pgr" 
            AlternatingRowStyle-CssClass="alt" 
            OnPageIndexChanging="grClientTransactions_PageIndexChanging" 
            onrowcommand="grClientTransactions_RowCommand"&gt;

            &lt;Columns&gt;
                &lt;asp:TemplateField ShowHeader="false"&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:LinkButton ID="lnkEquifaxResponse" runat="server" CommandName="EquifaxResponse" Text="View" CommandArgument='&lt;%# DataBinder.Eval(Container, "RowIndex") %&gt;'&gt;&lt;/asp:LinkButton&gt;
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;

                &lt;asp:TemplateField Visible="false" HeaderText="Equifax Response"&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:Label ID="lblEquifaxResponse" runat="server" Text='&lt;%# Bind("ResponseXML")%&gt;' &gt;&lt;/asp:Label&gt;&lt;/div&gt;                            
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;

            &lt;/Columns&gt;
            &lt;PagerStyle CssClass="pgr" /&gt;
            &lt;AlternatingRowStyle CssClass="alt" /&gt;
        &lt;/asp:GridView&gt;
    &lt;/div&gt;
</code></pre>

<p>I am new to programming so any help would be greatly appreciated.</p>
