Hello,
First, I already found this same topic under Forums -> WinForms -> GridView, but that thread does not answer to my problem.
I have radGridView1 binded to DataTable. I can add new rows to grid and delete rows from grid.
Error "This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row." occurs when I remove latest row I have added.
Here is the code which removes selected row:
Can you help me from here?
BR,
Tatu
First, I already found this same topic under Forums -> WinForms -> GridView, but that thread does not answer to my problem.
I have radGridView1 binded to DataTable. I can add new rows to grid and delete rows from grid.
Error "This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row." occurs when I remove latest row I have added.
Here is the code which removes selected row:
private void button2_Click(object sender, RoutedEventArgs e) |
{ |
List<DataRow> itemsToRemove = new List<DataRow>(); |
foreach (DataRow item in this.radGridView1.SelectedItems) |
{ |
itemsToRemove.Add(item); |
} |
foreach (DataRow item in itemsToRemove) |
{ |
((DataTable)this.radGridView1.ItemsSource).Rows.Remove(item); |
((DataTable)this.radGridView1.ItemsSource).AcceptChanges(); |
} |
DataTable emptyTable = new DataTable(); // this is for refreshing grid view |
radGridView1.ItemsSource = emptyTable; // this is for refreshing grid view |
radGridView1.ItemsSource = myDataTable; |
} |
Can you help me from here?
BR,
Tatu