title: UserAccounts_RowEditing/Updating is not working properly
body: <p>Alright, so I have a Gridview and added RowEditing and RowUpdating to it, but it won't really edit something.. This is my code for both:</p>
  
  <pre><code>protected void UserAccounts_RowEditing(object sender, GridViewEditEventArgs e)
  {
       UserAccounts.EditIndex = e.NewEditIndex;
       BindUserAccounts();
  }
  protected void UserAccounts_RowUpdating(object sender, GridViewUpdateEventArgs e)
  {
       int index = UserAccounts.EditIndex;
       GridViewRow row = UserAccounts.Rows[e.RowIndex];
       username = UserAccounts.Rows[e.RowIndex].Cells[1].Text;
       email = ((TextBox)row.Cells[2].Controls[0]).Text;
       MembershipUser user = Membership.GetUser(username);
       if (user != null)
       {
           user.Email = email;
           Membership.UpdateUser(user);
           ActionStatus.Text = string.Format("User {0} details have been successfully updated!", username);
       }
       UserAccounts.EditIndex = -1;
       BindUserAccounts();
  }
  </code></pre>
  
  <p>What am I doing wrong in here?</p>
  
  <p>EDIT: This is my BindUserAccounts:</p>
  
  <pre><code>private void BindUserAccounts()
  {
       int totalRecords;
       UserAccounts.DataSource = Membership.FindUsersByName(this.UsernameToMatch + "%", this.PageIndex, this.PageSize, out totalRecords);
       UserAccounts.DataBind();
  
       bool visitingFirstPage = (this.PageIndex == 0);
       lnkFirst.Enabled = !visitingFirstPage;
       lnkPrev.Enabled = !visitingFirstPage;
  
       int lastPageIndex = (totalRecords - 1) / this.PageSize;
       bool visitingLastPage = (this.PageIndex &gt;= lastPageIndex);
       lnkNext.Enabled = !visitingLastPage;
       lnkLast.Enabled = !visitingLastPage;
  }
  </code></pre>