petre ricardo

petre ricardo

  • NA
  • 194
  • 0

why is my DataGrid adds duplicate records?

Mar 17 2010 11:36 PM

Hi friend,
I have TreeView control with checked nodes, the program add each checked node a row to the DataGrid, The problem comes when it has to append rows the bound datatable, it can add first rows (node1) and second row(node2) but when it add third record(node3) it adds duplicate rows of first and second row and then adds the third row(node3)...
I have attached the code i ahve used and a video cast to make it clear ....hopefully :)
here isthe video
 
1. How do i fix this?
2. When i select all rows in the datagrid and hit delete it visually deletes all records but when i call the
 
private void dataGridView1_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
{
if (e.RowCount == 1)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
Console.WriteLine(row.Cells[1].Value.ToString());
}
}
}

it shows all teh records in the underlyng table of that DataGrid stil exits (i didnt add a screen cast to this sorry), how do i fix this as well?
 
thanks
 
 
 
 

Attachment: TestGrid.zip