I actually found an easy way of deleting the row:
After this:
BindingManagerBase bm = DataGrid1.BindingContext[DataGrid1.DataSource, DataGrid1.DataMember];
DataRow dr = ((DataRowView)bm.Current).Row;
since dr is the row I want to delete I just use the
Delete() method:
dr.Delete()...
The importRow() works fine, but
o use: DataTable.Rows[rowIndex].Delete()
I need to get the row index, but the problem is getting the correct index after sorting.
Any ideas?
That works!
Is there a way of getting the index/rownumber of the selected row, it has to be the correct index even if the column is sorted by clicking the header.
I want't to use the row index to move a row from DataGrid1 to DataGrid2, and delete that row from DataGrid1.
Thanks.
AllowSorting = true for the DataGrid.
I have clicked the top rows, which means row containing the
coulmns name, the rows would be sorted by that column asc
or desc.
Doesn't this means that the DataGrid is sorted.
Since I've been dealing with this problem for 2 days now, I'm really desperate...
Hi all
I have encountered the same problem getting the correct values after sorting in a colunm.
I have a button which runs the following code given in the previous reply:
DataRowView drv;
drv = ((DataView)DataGrid1.DataSource)[DataGrid1.CurrentRowIndex];
MessageBox.Show(drv[colIndex])...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.