title: Get value from hidden boundfield? ASP.NET
body: <p>I know the question I'm going to ask is already asked for by other people, but those answers are no solution for my problem.</p>
  
  <p>I have a gridview containing 2 BoundFields, 2 ButtonFields and a checkbox field (which is a TemplateField).</p>
  
  <p>I also have a datatable, filled with data from the database.</p>
  
  <p>In the aspx code I create my gridview with the fields set the last BoundField <code>Visible = false</code>.</p>
  
  <p>In my codebehind, I add the colums and bind the datasource to my datatable.</p>
  
  <p>But when I try to read the data from the hidden boundfield, that field is empty. The problem why I can't use the solutions mentioned with similar questions, is because the people assume the data gets filled in one by one, and not by binding a datatable to the datasource of the gridview.</p>
  
  <p>So my question is: Is their a way to get the data from the hidden boundfield and also retain the possibility to add the data by binding the datatable to the datasource of the gridview?
  And if so, is it posible to get the value from that field?</p>
  
  <p>p.s. I'm using asp.net/c# in visual studio 2010</p>
  
  <p>ASPX:</p>
  
  <pre><code>&lt;asp:GridView ID="gvSelect" runat="server" AutoGenerateColumns="False" BorderStyle="None" onrowcommand="gvTestSelect_RowCommand"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField&gt;
              &lt;HeaderTemplate&gt;
                  &lt;asp:CheckBox runat="server" ID="cbHeader" OnPreRender="cbHeader_PreRender" /&gt;
              &lt;/HeaderTemplate&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:CheckBox runat="server" ID="cbItems" /&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="field" HeaderText="Veld" SortExpression="field" /&gt;
          &lt;asp:ButtonField DataTextField="up" HeaderText="Omhoog" SortExpression="up" CommandName="up" Text="&amp;uarr;" /&gt;
          &lt;asp:ButtonField DataTextField="down" HeaderText="Omlaag" SortExpression="down" CommandName="down" Text="&amp;darr;" /&gt;
          &lt;asp:BoundField DataField="hidden" SortExpression="hidden" /&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Code Behind (where I fill the gridview):</p>
  
  <pre><code>//create array list and fill it with all columns
  Dictionary&lt;string, string&gt; dict = FillLists.getColumnsByTable(loader, ddlInfoTableI.SelectedItem.Value.ToString());
  
  //loop trough dictionary
  foreach (var val in dict)
  {
      //create new dtSelect datarow
      DataRow dr = dtSelect.NewRow();
  
      //set row values for column values
      dr["select"] = false;
      dr["field"] = val.Value.ToString();
      dr["up"] = new ButtonField { CommandName = "up", Text = loader.LoadResourceString(1024), HeaderText = "&amp;uarr;", ButtonType = ButtonType.Button, Visible = true };
      dr["down"] = new ButtonField { CommandName = "down", Text = loader.LoadResourceString(1025), HeaderText = "&amp;darr;", ButtonType = ButtonType.Button, Visible = true };
      dr["hidden"] = val.Key.ToString();
  
      //add the datarow
      dtSelect.Rows.Add(dr);
  
      //set datatable session to datatable
      Session["dtSelect"] = dtSelect;
  
      //set datasource of the gridview to datatable
      gvSelect.DataSource = dtSelect;
  
      //bind data to gridview
      gvSelect.DataBind();
  }
  </code></pre>
  
  <p>So now I need to get the data from the gridview (escpecialy from the hidden boundfield), because they can edit the gridview except the hidden boundfield, so that is the only way to know which original row it was.</p>