title: ASP.NET: Download file from database when clicking on file name on Grid View
body: <p>I have a grid view that displays all of uploaded files of an employee (data from SQL DB). </p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server"
  AutoGenerateColumns="False" AllowPaging="true" ShowFooter="false" PageSize="5"
  CssClass="table" AlternatingRowStyle-BackColor="WhiteSmoke"
  HeaderStyle-BackColor="#6C7A95" HeaderStyle-BorderColor="#666666" HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="2" HeaderStyle-ForeColor="White"
  OnPageIndexChanging="OnPaging" EmptyDataText="No Documents"&gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="file_name" HeaderText="File Name" /&gt;
          &lt;asp:BoundField DataField="upload_date" HeaderText="Date (GMT -7)" /&gt;
          &lt;asp:BoundField DataField="file_status" HeaderText="Status" /&gt;
  
          &lt;asp:TemplateField HeaderText="Employee's Note"&gt;
              &lt;ItemTemplate&gt;
                   &lt;a data-original-title='&lt;%# Eval("emp_note")%&gt;' href="#" class="demo-cancel-click" rel="tooltip"&gt;&lt;i class="icon-book"&gt;&lt;/i&gt;&lt;/a&gt;
               &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
  
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>The interface look like this:
  <img src="https://i.stack.imgur.com/oMED5.png" alt="enter image description here"></p>
  
  <p>I like to archive this: the file name will be a link button (or whatever the best way is) and when click on name it will download the file. So I modified the File Name column:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText =" File Name"&gt;
          &lt;asp:ItemTemplate&gt;
                 &lt;asp:LinkButton ID="lnkDownload" runat="server" 
                      OnClick="DownloadFile" Text='&lt;%#Eval("file_name") %&gt;' 
                      CommandArgument='&lt;%# Eval("file_id") %&gt;'&gt;&lt;/asp:LinkButton&gt;
           &lt;/asp:ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>But then the interface became: (file_name disappeared)</p>
  
  <p><img src="https://i.stack.imgur.com/QKHrk.png" alt="enter image description here"></p>
  
  <p>How do I get what I need? </p>