title: Gridview rowdatabound error : Multiple controls with the same ID 'hlLink' were found. FindControl requires that controls have unique ID
body: <p>I have a gridview that has link and description to be rendered on the page.</p>
  
  <p>written the below code in gridview in .aspx</p>
  
  <pre><code>      &lt;Columns&gt;
          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;p&gt;
                      &lt;asp:HyperLink ID="hlLink" runat="server" Target="_self"&gt;&lt;/asp:HyperLink&gt;&lt;/p&gt;
              &lt;/ItemTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;p&gt;
                      &lt;asp:Literal ID="litSummary" runat="server"&gt;&lt;/asp:Literal&gt;&lt;/p&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:TemplateField&gt;
              &lt;AlternatingItemTemplate&gt;
                  &lt;p&gt;
                      &lt;asp:HyperLink ID="hlLink" runat="server" Target="_self"&gt;&lt;/asp:HyperLink&gt;&lt;/p&gt;
              &lt;/AlternatingItemTemplate&gt;
              &lt;AlternatingItemTemplate&gt;
                  &lt;p&gt;
                      &lt;asp:Literal ID="litSummary" runat="server"&gt;&lt;/asp:Literal&gt;&lt;/p&gt;
              &lt;/AlternatingItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
      &lt;/Columns&gt; 
  </code></pre>
  
  <p>and below in .aspx.csin gridview rowdataboundevent</p>
  
  <pre><code>    protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              SearchResultItem data = (SearchResultItem)e.Row.DataItem;
              HyperLink hlLink = (HyperLink)e.Row.FindControl("hlLink");
              Literal litSummary = (Literal)e.Row.FindControl("litSummary");
              if (data.Description != null)
              {
                  hlLink.Text = data.Title;
                  hlLink.NavigateUrl = data.Path.Replace("&amp;amp;", "&amp;");
                  litSummary.Text = data.Description;
              }
              else
              {
                  hlLink.Text = data.Path;
                  hlLink.NavigateUrl = data.Path.Replace("&amp;amp;", "&amp;");
                  litSummary.Text = data.Path;
              }
  
          }
  </code></pre>
  
  <p>here SearchResultItem: is the result item that has link and description details.
  First time when row bound event is called, it binds the data correctly, second time when called throws error "Multiple controls with the same ID 'hlLink' were found. FindControl requires that controls have unique IDs.</p>
  
  <p>Please let me know whats error with the code.</p>
  
  <p>Thanks</p>