Dialog box opens automatically upon post back after initial opening

Dialog box opens automatically upon post back after initial opening

I have a dialog box hooked up to a button in a templaet fied of a gridview. On initial page load all is good, when I click a button on a row in the gridview it successfully opens the diaog box and displays the correct information. This is where it all goes wrong. Firts, when I close the dialog box, everything on the screen has gotten smaller. Second, when I select another record or do anything else that causes a post back, the original dialog box reappears on postback. If I close that box I am able to select another record and get the right info. On postback, repeat.
 
Here is my script:
 
<script type="text/javascript">

 $(document).ready(function() {
  $("#txtBeginDate").datepicker();
  $("#txtEndDate").datepicker();
 });



 $(document).ready(function() {
  $("#response").dialog({
   autoOpen: false,
   modal: true,
   height: "auto",
   width: "auto",
   title: "Equifax Response"
  });






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

  if ($("#lblDialog").text() != "") {
   $("#response").dialog("open");
  }
 });
</script>



 
Here is my relevent gridview markup:
 
<div id="Gridview">

 <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">
  
  <Columns>
   <asp:TemplateField ShowHeader="false">
    <ItemTemplate>
     <asp:LinkButton ID="lnkEquifaxResponse" runat="server"
      CommandName="EquifaxResponse" Text="View" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton>
    </ItemTemplate>
   </asp:TemplateField>
                   
   <asp:TemplateField Visible="false" HeaderText="Equifax Response">
    <ItemTemplate>
     <asp:Label ID="lblEquifaxResponse" runat="server" Text='<%# Bind("ResponseXML")%>' ></asp:Label></div>                           
    </ItemTemplate>
   </asp:TemplateField>     
  </Columns>





















 
Here is my div to populate my dialog:
 
 <div id="response" visible="false">
        <asp:Label ID="lblDialog" runat="server" ></asp:Label>
 </div>

 
On button click a method is called in the code behind to format an XML document and store it to the label in the above mentioned div.
 
Any thoughts on how to solve this problem? I am new to progaraming and jquery, any assistance would be greatly appreciated.
 
I  have also attached the above code as a txt file that may be easier to read.
 
Thanks