title: How to get a data field in gridview to become a url
body: <p>Again, I know this has been answered many a time, but I'm getting confused with all the examples. So I'll ask it in the way I need answered.</p>
  
  <p>I have a sql table, <code>supplylinks</code>. this has <code>rowid</code> (identity pk), <code>title</code> (varchar), <code>link</code> (varchar) and <code>description</code> (varchar).</p>
  
  <p>The link field is an actual hyperlink, a url.
  So for arguments sake, lets say the first row is:</p>
  
  <blockquote>
    <p>1 | Google | <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> | Google Search engine</p>
  </blockquote>
  
  <p>Easy enough.
  Now I'm loading this into a gridview.
  Nothing fancy, all done in c# code.</p>
  
  <pre><code>SqlConnection conn = new SqlConnection(@"Server=DEV6\MSSQLHOSTING;Database=Intranet;Trusted_Connection=True;");
          ds = new DataSet("ds");
          if (type.Equals("SAIX"))
          {
  
              SqlDataAdapter da = new SqlDataAdapter("select [Title],[Link],[Description] from SupplierLinks where SuppRowID = " + index, conn);
              da.Fill(ds);
          }
          if (type.Equals("Domian Related Links"))
          {
              SqlDataAdapter da = new SqlDataAdapter("select [Title],[Link],[Description] from DomainLinks where SuppRowID = " + index, conn);
              da.Fill(ds);
          }
          if (ds.Tables.Count &gt; 0)
          {
              if (ds.Tables[0].Rows.Count &gt; 0)
              {
  
                  grdLinks.DataSource = ds;
  
                  grdLinks.DataBind();
              }
          }
          else
          {
              lblDisp.Text = "";
              lblError.Text = "There are no links for that type";
          }
  </code></pre>
  
  <p>Nothing wrong there. I get my info. But I want to now make the link that is returned by the sql table and put into the gridview as a proper link so that when someone clicks on the link, they are redirected to Google, in this instance.</p>
  
  <p>Please help. All other coding around here is confusing me. Lots are saying I must add a hyperlink column to the gridview. But where?</p>
  
  <p>I was getting so far, then got lost as to what to bind.</p>
  
  <pre><code>&lt;asp:GridView ID="grdLinks" runat="server"&gt;
      &lt;Columns&gt;
          &lt;asp:HyperLinkField DataNavigateUrlFields="col2" 
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Like I said, I'm lost and confused.</p>
  
  <p>Thank you in advance.</p>