title: How to get the new values while editing a gridview?
body: <p>I'm trying to update some records in my table using the <strong>GridView Item templates</strong>. It's like this:</p>
  
  <pre><code>&lt;asp:GridView ID="grdCursos" runat="server" CssClass="grdTable" 
                  AutoGenerateColumns="False" DataKeyNames="CourseID"&gt;
                  &lt;Columns&gt;
                      &lt;asp:TemplateField HeaderText="ID" Visible="false"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblID" runat="server" Text='&lt;%#Bind("[CourseID]") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Nome"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="txtCourseName" runat="server" Text='&lt;%#Bind("[CourseName]") %&gt;' Width="50"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblCourseName" runat="server" Text='&lt;%#Bind("[CourseName]") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="# de Questões"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="txtMaxQuestions" runat="server" Text='&lt;%#Bind("[CourseMaxQuestions]") %&gt;' Width="20"&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblMaxQuestions" runat="server" Text='&lt;%#Bind("[CourseMaxQuestions]") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Data de atribuição"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblCourseSince" runat="server" 
                                  Text='&lt;%#Bind("[CourseSince]","{0:d}") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Nome do arquivo"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:FileUpload ID="fileCourse" runat="server"/&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblCourse" runat="server" Text='&lt;%#Bind("[CourseFileName]") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                          &lt;ItemStyle Width="200px" /&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:CommandField ButtonType="Image" EditImageUrl="~/site/edit.jpg" 
                          ShowEditButton="True" DeleteImageUrl="~/site/cancel.jpg" 
                          UpdateImageUrl="~/site/accept.jpg" CancelImageUrl="~/site/cancel.jpg" 
                          ShowDeleteButton="True" CancelText="Cancelar" DeleteText="Inativar" 
                          EditText="Editar" UpdateText="Atualizar"&gt;&lt;/asp:CommandField&gt;
                      &lt;asp:CommandField ShowEditButton="True" /&gt;
                  &lt;/Columns&gt;
  </code></pre>
  
  <p>As soon as I click in <strong>Edit Link</strong>, some of my GriView's columns become a TextBox which I can edit. Then, when I click update button it calls my <code>grdCursos_RowUpdating</code> method. The problem is that I can't get the <strong>new values</strong> the user gave as input. I call a <code>MsgBox</code> to show the values I want to update and it shows the old values only.</p>
  
  <p>This is my method:</p>
  
  <pre><code>Protected Sub grdCursos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdCursos.RowUpdating
      Dim updatingRow As GridViewRow = grdCursos.Rows(e.RowIndex) 'Recupera a linha que está sendo editada
  
      'Recupera os dados cadastrados
      Dim ID As Label = updatingRow.FindControl("lblID")
      Dim txtCourseName As TextBox = updatingRow.FindControl("txtCourseName")
      Dim txtMaxQuestions As TextBox = updatingRow.FindControl("txtMaxQuestions")
      Dim CourseFile As FileUpload = updatingRow.FindControl("fileCourse")
  
      MsgBox(String.Format("ID={0}, Nome do curso={1}, # de questoes={2}, Nome do arquivo={3}", ID.Text, txtCourseName.Text, txtMaxQuestions.Text, CourseFile.FileName))
      Exit Sub
      ....
  </code></pre>
  
  <p>How can I get the new values?</p>