public static void DataGrid1_UpdateCommand (object source, DataGridCommandEventArgs e) { DataGrid DataGrid1 = (DataGrid) source; MyDataSource ds = new MyDataSource (); TextBox edittedName = (TextBox) e.Item.Cells [1].Controls [0]; ds.UpdateItem (e.Item.DataSetIndex, Int32.Parse (e.Item.Cells [0].Text), edittedName.Text); DataGrid1.EditItemIndex = -1; DataGrid1.DataBind (); }