This is a migrated thread and some comments may be shown as answers.

This row has been removed from a table and does not have any data

2 Answers 477 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tatu Nokelainen
Top achievements
Rank 1
Tatu Nokelainen asked on 05 Feb 2010, 09:07 AM
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:

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

2 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 11 Feb 2010, 07:26 AM
Hi Tatu Nokelainen,

This issue should be fixed with our latest internal build. Please try your scenario with the latest binaries and let me know if the problem persists.

Best wishes,
Nedyalko Nikolov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Tatu Nokelainen
Top achievements
Rank 1
answered on 11 Feb 2010, 09:00 AM
Hello,

Now it works, great!

Thank you for your good support,
Tatu Nokelainen
Tags
GridView
Asked by
Tatu Nokelainen
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Tatu Nokelainen
Top achievements
Rank 1
Share this question
or