Vote count: 0
I have several dgvs on a single form. They all have bound data source. They all need to have the ability to "soft" delete rows (not really delete them, but mark the row for deletion and hide it on the grid). The delete will happen at a later date.
I do have a filter on the on the grid: hiatusBindingSource.Filter = "IsDeleted = false";
But I am not sure how to apply the filter after I set the "delete" flag so I came up with the following code to handle a specific dgv.
I want to just have one generic sub to handle all of the dgvs. (I have multiple forms with the same issue.)
private void dgvHiatus_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
e.Cancel = true;
hiatusBindingSource.SuspendBinding();
e.Row.Visible = false;
hiatusBindingSource.ResumeBinding();
((Hiatus)e.Row.DataBoundItem).IsDeleted = true;
SetFormMode(Globals.FormStatusMode.Save);
}
TIA
asked 52 secs ago
This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.
DataGridView: c# generic UserDeletingRow for multiple grids on same form
Aucun commentaire:
Enregistrer un commentaire