private void LoadDgvFees() { DataTable dataTable = new DataTable(); /// Set the datatable based on the SelectedIndex of <see cref="cboInvestmentViews"/>. switch (cboFeeViews.SelectedIndex) { case 0: dataTable = PlanAdvisorFee.GetAssociatedActive(CurrentPlanAdvisor); break; case 1: dataTable = PlanAdvisorFee.GetAssociatedActive(CurrentPlanAdvisor); break; default: return; } dgvFees.DataSource = dataTable; // Display/order the columns. dgvFees.Columns["PlanAdvisorFeeId"].Visible = false; dgvFees.Columns["PlanId"].Visible = false; dgvFees.Columns["AdvisorId"].Visible = false; dgvFees.Columns["CreatedBy"].Visible = false; dgvFees.Columns["ModifiedBy"].Visible = false; dgvFees.Columns["StateCode"].Visible = false; dgvFees.Columns["Fee"].DisplayIndex = 0; dgvFees.Columns["BenchmarkFee"].DisplayIndex = 1; dgvFees.Columns["AsOfDate"].DisplayIndex = 2; dgvFees.Columns["ModifiedOn"].DisplayIndex = 3; }
private void LoadDgvFees() { int currentCellRow = 0; int currentCellCol = 0; if (dgvFees.CurrentCell != null) { currentCellRow = dgvFees.CurrentCell.RowIndex; currentCellCol = dgvFees.CurrentCell.ColumnIndex; } DataTable dataTable = new DataTable(); /// Set the datatable based on the SelectedIndex of <see cref="cboInvestmentViews"/>. switch (cboFeeViews.SelectedIndex) { case 0: dataTable = PlanAdvisorFee.GetAssociatedActive(CurrentPlanAdvisor); break; case 1: dataTable = PlanAdvisorFee.GetAssociatedActive(CurrentPlanAdvisor); break; default: return; } dgvFees.DataSource = dataTable; // Display/order the columns. dgvFees.Columns["PlanAdvisorFeeId"].Visible = false; dgvFees.Columns["PlanAdvisorId"].Visible = false; dgvFees.Columns["CreatedBy"].Visible = false; dgvFees.Columns["ModifiedBy"].Visible = false; dgvFees.Columns["StateCode"].Visible = false; // Display/order the columns. dgvFees.Columns["Notes"].Visible = false; dgvFees.Columns["Name"].DisplayIndex = 0; dgvFees.Columns["Fee"].DisplayIndex = 1; dgvFees.Columns["Benchmark25Fee"].DisplayIndex = 2; dgvFees.Columns["Benchmark25Fee"].HeaderText = "25% Benchmark"; dgvFees.Columns["Benchmark50Fee"].DisplayIndex = 3; dgvFees.Columns["Benchmark50Fee"].HeaderText = "50% Benchmark"; dgvFees.Columns["Benchmark75Fee"].DisplayIndex = 4; dgvFees.Columns["Benchmark75Fee"].HeaderText = "75% Benchmark"; dgvFees.Columns["RevenueSharingPaid"].DisplayIndex = 5; dgvFees.Columns["RevenueSharingPaid"].HeaderText = "Revenue Sharing Paid"; dgvFees.Columns["ForfeituresPaid"].DisplayIndex = 6; dgvFees.Columns["ForfeituresPaid"].HeaderText = "Forfeitures Paid"; dgvFees.Columns["ParticipantsPaid"].DisplayIndex = 7; dgvFees.Columns["ParticipantsPaid"].HeaderText = "Participants Paid"; dgvFees.Columns["PlanSponsorPaid"].DisplayIndex = 8; dgvFees.Columns["PlanSponsorPaid"].HeaderText = "Plan Sponsor Paid"; dgvFees.Columns["AsOfDate"].DisplayIndex = 9; dgvFees.Columns["ModifiedOn"].DisplayIndex = 10; dgvFees.Columns["CreatedOn"].DisplayIndex = 11; if (dgvFees.RowCount > 0 && dgvFees.ColumnCount > 0) { DataGridViewCell selectedCell = dgvFees.Rows[currentCellRow].Cells[currentCellCol]; if (selectedCell != null && selectedCell.Visible) { dgvFees.CurrentCell = selectedCell; } else { dgvFees.CurrentCell = dgvFees.FirstDisplayedCell; } } }