G
Guest
I can't access the rows of my dataGrid after I call a dg.Delete() on some of
the rows.
I populate a datagrid from a datatable like this
dataGrid1.DataSource = dt;
Then I loop through each datarow deleting some of the rows like this:
dr.Delete();
I then refresh the grid to get the remaining rows in the grid like this:
dataGrid1.Refresh();
I then move the datagrid data into a datatable like this:
dt1 = (DataTable)dataGrid1.DataSource;
Then when I try to access the rows of data in the datatable like this:
sb.Append( dt1.Rows[ curRow][ curCol].ToString( ).Trim( ));
I get this exception:
"An unhandled exception of type
'System.Data.DeletedRowInaccessibleException' occurred in system.data.dll
Additional information: Deleted row information cannot be accessed through
the row."
What do I need to do to access the remaing rows in the datagrid.
Thanks
Paul
the rows.
I populate a datagrid from a datatable like this
dataGrid1.DataSource = dt;
Then I loop through each datarow deleting some of the rows like this:
dr.Delete();
I then refresh the grid to get the remaining rows in the grid like this:
dataGrid1.Refresh();
I then move the datagrid data into a datatable like this:
dt1 = (DataTable)dataGrid1.DataSource;
Then when I try to access the rows of data in the datatable like this:
sb.Append( dt1.Rows[ curRow][ curCol].ToString( ).Trim( ));
I get this exception:
"An unhandled exception of type
'System.Data.DeletedRowInaccessibleException' occurred in system.data.dll
Additional information: Deleted row information cannot be accessed through
the row."
What do I need to do to access the remaing rows in the datagrid.
Thanks
Paul