private void gvTransaction_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (gvTransaction.Columns[e.ColumnIndex].Name == "cDel") { trn_book_event row = gvTransaction.Rows[e.RowIndex].DataBoundItem as trn_book_event; if (row != null) { row.tbe_active = false; } } }
private void gvTransaction_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { if (_ListBookEvent != null) { int indx = _ListBookEvent.Where(x => x.tbe_active == true).Count(); foreach (DataGridViewRow row in gvTransaction.Rows) { trn_book_event ev = row.DataBoundItem as trn_book_event; trnbookeventBindingSource.SuspendBinding(); if (ev.tbe_active == true) { row.Visible = true; row.Cells[0].Value = indx; indx--; } else { row.Visible = false; } trnbookeventBindingSource.ResumeBinding(); var tname = ListMsEvent.Where(x => x.mbe_id == ev.mbe_id).Select(x => x.mbe_tname).FirstOrDefault(); row.Cells["cEventName"].Value = string.IsNullOrEmpty(tname) ? "" : tname; row.Cells["TransactionShow"].Value = ev.tbe_remark; try { using (InhCheckupDataContext cdc = new InhCheckupDataContext()) { var uname = cdc.mst_user_types.Where(x => x.mut_username == ev.tbe_create_by).Select(x => x.mut_fullname).FirstOrDefault(); row.Cells["colUser"].Value = string.IsNullOrEmpty(uname) ? "" : uname; } } catch { } } } }