title: Disable Controls or Redirect to Default page after file download through Response Object ASP.Net
body: <p>I am unable to make the controls visible off properly. All gets visible off IN visibleFalse() function but chkToU text is still remained visible but checkbox gets invisible. And button did not change its text to "OK"</p>
  
  <pre><code>--HTML
  &lt;script&gt;
      function visibleFalse() {
          $("#&lt;%= lblMessage.ClientID %&gt;").css('display', 'none');
          $("#&lt;%= chkToU.ClientID %&gt;").css('display', 'none');
          $("#&lt;%= btnToU.ClientID %&gt;").css('display', 'none');
          $("#&lt;%= btnOK.ClientID %&gt;").val('OK');
      }
  &lt;/script&gt;
  
  &lt;div style="padding-top: 5px"&gt;
      &lt;asp:CheckBox ID="chkToU" Style="margin-left: 12px;" runat="server" AutoPostBack="true"
              Text="&amp;nbsp;I agree to the whole contents of the" OnCheckedChanged="chkToU_CheckedChanged"/&gt;
      &lt;asp:LinkButton ID="btnToU" runat="server" 
          OnClientClick="return visibleFalse();"
          UseSubmitBehavior="false" onclick="btnToU_Click"&gt;ToU
      &lt;/asp:LinkButton&gt;
  &lt;/div&gt;
  
  &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt;
      &lt;ContentTemplate&gt;
          &lt;asp:LinkButton ID="btnOK" OnClick="btnOK_Click" Width="60px" Text="Cancel" 
              CssClass="btn btn-success btn-sm" runat="server"&gt;
          &lt;/asp:LinkButton&gt;
          &lt;br /&gt;
          &lt;asp:Label ID="lblMessage" ForeColor="Red" runat="server" Text=""&gt;&lt;/asp:Label&gt;
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  
  --CODE BEHIND       
  protected void btnToU_Click(object sender, EventArgs e)
  {
      if (DownloadFile())
      {
          //bellow code not working -- its redirecting to default but file download not work
          //it also doesnt make visible false in code behind due to response object
          //Response.Redirect("../Default.aspx");
          //chkToU.Visible = false;
          //lblMessage.Visible = false;
          //btnToU.Visible = false;
          //btnOK.Text = "OK";
      }
  }
  
  private bool DownloadFile()
  {
      fileName = "TermsAndConditions.pdf";
      Response.Clear();
      Response.Buffer = true;
      Response.ContentType = "application/pdf";
      Response.AddHeader("content-disposition", "attachment;filename=" + fileName);     // to open file prompt Box open or Save file         
      Response.Charset = "";
      Response.Cache.SetCacheability(HttpCacheability.NoCache);
      Response.TransmitFile(Server.MapPath("../Files/TermsAndConditions.pdf"));
      Response.Flush();
      lblMessage.Visible = false;
      return true;
  }
  </code></pre>
  
  <p>Please help me. Thanks</p>