protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label1.Text = "Updating..."; //Get the datakey field of the current row int id = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString()); GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; Dictionary <string, string> values = new Dictionary <string, string>(); int counter = -1; //compensate for the fact first cell is the Edit/Delete one foreach (TableCell cell in row.Cells) { foreach (Control control in cell.Controls) { if (control is TextBox) { TextBox tb = (TextBox)control; string colname = columns[counter].ToString(); values.Add(colname, tb.Text); } } counter++; } eh.Update(tablename, id, values); GridView1.EditIndex = -1; BindDataGrid(); }