title: How to hide a TemplateField column in a GridView
body: <p>How can I hide a TemplateField column in a GridView?</p>
  
  <p>I tried the following:</p>
  
  <pre><code>&lt;asp:TemplateField ShowHeader="False" Visible='&lt;%# MyBoolProperty %&gt;' &gt;
  &lt;ItemTemplate&gt;
      &lt;asp:LinkButton ID="attachmentButton" runat="server" ... /&gt;
  &lt;/ItemTemplate&gt;
  </code></pre>
  
  <p></p>
  
  <p>but it didn't work and gives the following error:</p>
  
  <blockquote>
    <p>Databinding expressions are only supported on objects that have a DataBinding event. 
        System.Web.UI.WebControls.TemplateField does not have a DataBinding event.</p>
  </blockquote>
  
  <p>I tried also to hide it programmatically, but seems it's not possible to get a column by the name because there iss no name for <code>TemplateField</code> column.</p>