title: Dynamically add HyperLink in GridView
body: <p>I have two types of code:
  1st:</p>
  
  <pre><code>               &lt;Columns&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:HyperLink runat="server" Text="Скачать объект" NavigateUrl='&lt;%#"objects/" + Eval("Идентификатор") %&gt;'&gt;&lt;/asp:HyperLink&gt;
                      &lt;/ItemTemplate&gt;    
                  &lt;/asp:TemplateField&gt;
                 &lt;/Columns&gt;
  </code></pre>
  
  <p>works normal. But TemplateField showed everytime.</p>
  
  <p>2nd</p>
  
  <pre><code>            TemplateField templField = new TemplateField();
              HyperLink hypLink = new HyperLink();
              hypLink.NavigateUrl = "&lt;%#\"objects/\" + Eval(\"Идентификатор\") %&gt;";
              hypLink.Text = "Скачать объект";
              templField.InsertItemTemplate = (ITemplate)hypLink;
              tableResults.Columns.Add(templField);
  </code></pre>
  
  <p>dosn't work with error: Unable to cast object of type 'System.Web.UI.WebControls.HyperLink' to type 'System.Web.UI.ITemplate'. Why in 1st time HyperLink added, in 2nd time didn't?</p>