title: how to get control id from gridview in asp.net?
body: <p>I need control id from grid view to use Trigger. </p>
  
  <p>My code is here :</p>
  
  <pre><code>&lt;asp:GridView ID="gvDetails" CssClass="table table-striped table-bordered datatables dataTable" DataKeyNames="folder_path" CellPadding="5" runat="server" AutoGenerateColumns="false" Width="100%"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField HeaderText="Select"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:CheckBox ID="chkSelect" runat="server" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="attachment_name" HeaderText="Attachment" /&gt;
          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:LinkButton ID="lnkDownload" Text="Download" runat="server" OnClick="DownloadFile"&gt;&lt;/asp:LinkButton&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
  
          &lt;asp:TemplateField HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass="hideGridColumn"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:HiddenField ID="hdnAttach_Id" Value='&lt;%#(Eval("attachment_id").ToString())%&gt;' runat="server" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt;
      &lt;HeaderStyle BackColor="#2FBDF1" Font-Bold="true" /&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I need code like...</p>
  
  <pre><code>    &lt;Triggers&gt;           
          &lt;asp:PostBackTrigger ControlID="lnkDownload" /&gt;
      &lt;/Triggers&gt;
  </code></pre>
  
  <p>how to get "lnkDownload" id from gridview?</p>
  
  <p>Exception :
  <img src="https://i.stack.imgur.com/Mlr3L.png" alt="enter image description here"></p>