title: Adding a HyperLink column to a GridView from a DataTable
body: <p>I got this:</p>
  
  <pre><code>public partial class VerAgenda : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
  
  
          if (!IsPostBack)
          {
  
  
              List&lt;Funcion&gt; fun = Festival.Instancia.ListaFunciones;
              DataTable dt = new DataTable();
  
  
  
              if (fun.Count() == 0)
                  mensaje.InnerText = "No hay funciones disponibles";
  
              dt.Columns.Add(new DataColumn("Espectaculo", typeof(string)));
              dt.Columns.Add(new DataColumn("Fecha", typeof(string)));
              dt.Columns.Add(new DataColumn("Hora", typeof(string)));
              dt.Columns.Add(new DataColumn("Sala", typeof(string)));
              dt.Columns.Add(new DataColumn("Detalles", typeof(string)));
  
              foreach (Funcion f in fun)
              {
                  string pais = "";
                  while (pais == "")
                  {
                      List&lt;Espectaculo&gt; esp = Festival.Instancia.ListaEspectaculos;
                      int es = 0;
                      while (es &lt; esp.Count() &amp;&amp; pais == "")
                      {
                          if (esp[es].Nombre == f.Espectaculo)
                              pais = esp[es].Pais;
                          es++;
                      }
                  }
                  string link = "test";
                  dt.Rows.Add(f.Espectaculo, f.Fecha, f.HoraIni, pais, link);
                  tblAgenda.DataSource = dt;
                  tblAgenda.DataBind();
                  this.tblAgenda.Visible = true;                
  
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>For this markup:</p>
  
  <pre><code>   &lt;asp:GridView ID="tblAgenda" runat="server"&gt;
     &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Fancy, I know. I need to know how to add an URL to each row, formatting it from details on the list (ie: "/xxx.aspx?funcion" + fun.IndexOf[f] + ".aspx" or something like that. I think that would be an HyperLinkColumn or something, but I can't seem to make it work.</p>
  
  <p>The idea would be to populate the GridView server-side... It works fine for the strings right now.</p>
  
  <p>I realize this is a most newbie question, but I would really appreciate some help...</p>
  
  <p>Thanks in advance.</p>