| |

VerySource

 Forgot password?
 Register
Search
View: 901|Reply: 5

When the DataGrid modifies one row of data, if it does not jump away from this row of data, its RowState is UnChanged. L

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-16 14:00:01
| Show all posts |Read mode
When DataGrid modifies one row of data, if it does not jump away from this row of data, its RowState is UnChanged, which means that if you do not move the Posation of the currently modified row to another row, use GetChange() to update the Table bound in the DataSet of this DataGrid. You will not be able to get the modified data at all. How to solve this problem? Do you have to tell the user that you must move the input focus to another row when you modify a row of data in the DataGrid? If there is only one table associated with this DataGrid One row of data, what should I do?
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-22 00:00:01
| Show all posts
DataRow.SetModified
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-22 01:00:01
| Show all posts
Should be DataBinding.EndEdit()
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-22 10:00:01
| Show all posts
I also have this problem, helpless.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-22 10:15:01
| Show all posts
There is a solution:
Execute EndEdit() separately for each row in the bound DataTable;

dgv.EndEdit();
foreach (DataRow drow in dgvDT.Rows) drow.EndEdit();
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-12-22 10:30:01
| Show all posts
I have encountered this problem, you should use BindingSource to solve it, and then bingdingSource.EndEdit(); will submit your changes to the corresponding DataSet, then you can do the corresponding operations on the DataSet. Understand! ! !
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list