title: C# GridViews - Make the cells in one column link to another page when clicked
body: <p>I have a grid view which is populated from a database. </p>
  
  <p>I need to make it so that each of the cells in a particular column, when clicked will link through to a second page and pass the cell's text value as a query string (ie link to <a href="http://mysite.com/page.aspx?CellText=" rel="nofollow">http://mysite.com/page.aspx?CellText=</a>'blah blah blah'). Sounds simple I know but I just can't figure it out!</p>
  
  <p>This is what my page looks like at the moment:</p>
  
  <pre><code>&lt;asp:GridView id="gdvTargets" 
            runat="server" 
            AutoGenerateEditButton="true" 
            OnRowEditing="gdvTargets_RowEdit"
            OnRowUpdating="gdvTargets_RowUpdating" 
            OnRowUpdated="gdvTargets_RowUpdated" 
            OnRowCancelingEdit="gdvTargets_RowCancelingEdit"
  
            cssClass="grid"
            &gt;
  &lt;HeaderStyle CssClass="GridHeader"&gt;&lt;/HeaderStyle&gt;
  </code></pre>
  
  <p></p>
  
  <p>And my c# code behind it:</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
      {
  year = Request.QueryString["YearSelector"];
  targetType = Request.QueryString["TargetType"];
  
        gdvTargets.DataSource = this.Ets.Api.Util.Db.GetDataTable("EXEC sp_getTargets " + year + ", " + targetType).Return;
        gdvTargets.DataBind();
  
      }
  </code></pre>
  
  <p>This results in a table which looks something like this:</p>
  
  <pre><code>ID        System        Target 1       Target 2       Target3       Target 4
  0         ALL           10             20             15             10
  2         Machine1      4              7              7              7
  5         Xfgb 45       6              13             8              3
  </code></pre>
  
  <p>I would like the system column to be clickable and link through to a new page but take the name of the system with it. Hope this makes sense! Thanks for your help :D</p>