By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,434 Members | 2,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,434 IT Pros & Developers. It's quick & easy.

C# Deleting Row in DataView filtered with RowFilter

P: 2
Hi,
I am really in a deadlock with this problem.

In my VS2005 C# handheld application, I have a grid with Workorders.

Another grid (child) are the ACTIONS, performed for each workorder.

Both grids have Dataviews as DataSource.

The child grid, filtered with RowFilter in the DataView works fine.

But when I try to delete a record in this child grid, I cannot figure out, how to get the absolut rownumber of the DataView.

EXAMPLE:

I try to delete the second row in the grid.
When I say Grid.DataSource.CurrentCell.RowNumber I get a 1, because it is the second visible record.
But then, when I say: Dataview.Table.Rows.RemoveAt(myposition), it deletes the ABSOLUT ROW 1 in the dataview and this could be from a complete different workorder (ParentView).

When I see the filtered records in the child view, how can I RECEIVE the ABSOLUT ROWNUMBER in the dataview and NOT the VISIBLE ROW from the grid.

Again, this is a C#, mobile application, so I might not have all functions available.

I am very greatful for every input to solve this problem. Thanks.

Hans Pietschnig
pietschnig@usa.com
Oct 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: 6
if the grid is bounded to a dataview you can delete the datagridview row,
this will change the coresponding record in the dataviw, and will change it's state to deleted.
then you can get a datatable containing all the deleted records:
datatable dtDel=YourDSource.getchanges() //get the deleted rows
now use foreach row in dtDel.
on each row you should write:
MyDataRow.rejectchanges();
get the data from the record (etc - to delete it from the db..)
MyDataRow.delete();
Oct 26 '06 #2

P: 2
Thank you so much for your input.

But as much as I could see, does the compact .NET framework not offer the DataGridView.

Thank you again

HansP
Oct 26 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.