I have gridview, it's datasource is list<string> and I added one checkbox column to select rows that I want to delete then I press delete.
attachdatagrid.DataSource = ConceptProperties.conceptsattachmentsfilename[mouseOverIndex].Select(x => new { FileName = x }).ToList();
the problem is my
gridview EditMode
properties is EditOnKeystroke, and when I wrote
if ((bool)dr.Cells[0].Value != false)
{
found = true;
ConceptProperties.conceptsattachments[mouseeditIndex].RemoveAt(dr.Index);
ConceptProperties.conceptsattachmentsfilename[mouseeditIndex].RemoveAt(dr.Index);
attachdatagrid.Rows.RemoveAt(dr.Index);
}
I got exception :
Rows cannot be programmatically removed unless the DataGridView is data-bound to an IBindingList that supports change notification and allows deletion.
how can I delete the row?