title: How to Update ONLY the Gridview in C#
body: <p>I have gridview in my C# ASP.net application.</p>
  <p>When a user edits a row, all I want to do is update the gridview's datasource (Not the database yet, since I'm just taking the datagrid's datasource at the end and pushing it into my database as a dataset).</p>
  <p>But The values I get are the old values, not the updated values im editing on the gridview.</p>
  <p>Why is this happening? I'm following all the advice on these links.</p>
  <pre><code>    protected void grdViewDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
      {
          GridViewRow row = (GridViewRow)grdViewDetails.Rows[e.RowIndex];
          int adsf = row.Controls.Count;
  
          foreach (Control item in row.Controls)
          {
              if (item.Controls[0] is TextBox)
             {
                 TextBox textbox = (TextBox)item.Controls[0];
                 string x = textbox.Text;
  
  //on the second for loop the string variable x = Employee1
             }
             if (item.Controls[0] is Label)
             {
                 Label mylabel = (Label)item;
                 //do stuff
             }
  </code></pre>
  <p><img src="https://i.stack.imgur.com/313Hg.png" alt="enter image description here" /></p>
  <p><img src="https://i.stack.imgur.com/6ywKo.png" alt="enter image description here" /></p>
  <p>Now that textbox variable x should be xxxxxxx, but its still the old value.... why does this happen?</p>
  <p>Cant you just update the gridview WITHOUT updating any other datasets/sources. Since I use the whole datasource of the gridview at the end.</p>