title: how to cancel enter key event for file download after file is being downloaded in asp.net using C#
body: <p>I have a page that has search box and the search will be triggered when the user hits enter key (I am checking this search on <code>IsPostBack</code> by enter key. Then when search is completed, the user is able to hit download on the link of the file displayed from the search.</p>
  
  <p>The problem is when the user hits the link and go back to the search box, the enter key triggers the download file again. </p>
  
  <p>How can I clear this event after the file is downloaded, so it triggers the <code>IsPostBack</code> again.?</p>
  
  <p>NOTE: I am using Linkbutton control in a Gridview control to trigger the file download.</p>
  
  <p>the code for downloading the file:</p>
  
  <pre><code> protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
          {
              string[] arg = new string[2];
              if (e.CommandName == "DownloadFile")
              {
                  arg = e.CommandArgument.ToString().Split(';');
                  string fileName = arg[0];
                  string path = arg[1];
                  Response.Clear();
                  Response.ContentType = "Application/octet-stream";
                  Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName));
                  Response.TransmitFile(Server.MapPath(path + fileName));
                  Response.End();
              }
          }
  </code></pre>