title: Getting values from templatefields gridview - C#
body: <p>I am using a gridview to display a table queried from a database...</p>
  
  <p>In this gridview I also added a buttonfield, and 3 template fields...</p>
  
  <p>When i press the buttonfield the data from the database is acquired, but the
  manual data inserted from the template fields are not.. It seems that null values are acquired.</p>
  
  <p>From the xml file i am firing the following event: </p>
  
  <pre><code>OnRowCommand="GridView1_SelectedIndexChanged1"
  </code></pre>
  
  <p>and have the following method to catch that event:</p>
  
  <pre><code>protected void GridView1_SelectedIndexChanged1(object sender, GridViewCommandEventArgs e)
          {
              int x = Convert.ToInt32(e.CommandArgument);
              GridView1.SelectRow(x);
  
              GridViewRow row = GridView1.Rows[x];
  
              Response.Write(row.Cells[0].Text + "\t");
              Response.Write(row.Cells[1].Text + "\t");
              Response.Write(row.Cells[2].Text + "\t");
              Response.Write(row.Cells[3].Text + "\t");
              Response.Write(row.Cells[4].Text + "\t");
              Response.Write(row.Cells[5].Text + "\t");
              Response.Write(row.Cells[6].Text + "\t");
              Response.Write(row.Cells[7].Text + "\t");
              Response.Write(row.Cells[8].Text + "\t");  
             }
  </code></pre>
  
  <p>Any ideas on how i can get the values from that template field? do i need to catch another event rather than GridViewCommandEventArgs? If so what event should i throw from the xml part?</p>
  
  <p>Thanks,</p>