private void questionsGrid_UpdateCommand(object source, DataGridCommandEventArgs e) { Off(); TextBox c = (TextBox)e.Item.Cells[3].Controls[1]; int sid = int.Parse(e.Item.Cells[0].Text); using (BaseDb db = DbFactory.ConstructDatabase()) db.AddAnswer(sid, c.Text, false); questionsGrid.EditItemIndex = -1; Bind(); }