protected void ASPxGridView_LoginAccount_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { Guid key = Guid.Parse(e.Keys[0].ToString()); var loginAccounts = (from la in session.GetObjectByKey <Person>(PersonId).LoginAccounts where la.LoginAccountId == key select la).FirstOrDefault(); if (loginAccounts != null) { loginAccounts.RowStatus = Constant.ROWSTATUS_DELETED; loginAccounts.Save(); } Temp_LoginAccount.Remove(Temp_LoginAccount.Where(x => x.LoginAccountId == key).FirstOrDefault()); ASPxGridView_LoginAccount.DataSource = Temp_LoginAccount; ASPxGridView_LoginAccount.DataBind(); e.Cancel = true; (sender as ASPxGridView).CancelEdit(); }