In a UltraGrid (Infragistics.Win.UltraWinGrid.UltraGrid), how can I know if the selected row has been updated in the DataSource associated of the grid?I try to insert a row but when you update the DataSet associated with the grid (pAdapterArt.Update (pDataSet, table)) generate error for example by primary key duplicate, so the record is not inserted.Later, How can I identify that the row selected has been updated in a DataSet of the grid or not?Thank you
Hello ddol,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
Hi,
I'm afraid I am still having trouble understanding you.
If you edit a cell in the grid and that edit is rejected by the data source, then the user will be unable to leave the cell. So you cannot "navigate through the rows" while the grid is in this state.
Once you leave the row, that row has to be committed to the data source. The DotNet Framework will do this automatically. So if there is a DataSource error and you are able to navigate to a different row, then something is seriously wrong.
If you are just trying to detect if a row is a new row or an existing row, then IsAddNew is the correct property. If it's returning false, then it's not a new row - the row has been committed to the data source at some point. Or perhaps the row is not a new row because it's a TemplateAddRow. Try checking IsTemplateAddRow, also.
I will try to re-explain my problem.I have an editable grid, whose DataSource is associated with a DataSet.In the grid I add a row forcing an error, so can not be updated in the DataSource as the update generates an exception. Until this point all is correct.
But when I navigate through the rows, how can I identify that it's a new row that has not been updated in the DataSource? Why Row.IsAddNew is false?? In the process implemented to eliminate rows, if you have not been updated in the database (DataSource), only I have to clean the grid, do not access the database, and I don't know how to identify it ...
I'm not exactly sure what you are asking.
There are two layers of updating that take place when you use a grid or other bound control. The first layer is between the grid and it's DataSource. Changes made in the grid are written to the DataSource depending on the UpdateMode property. By default, it happens whenever the grid loses focus or the focus leaves a grid cell.
The second layer is between the grid's DataSource and the back end. The grid has no role in this process. If you are using a DataSet, then the DataSet itself tracks all changes that are made to it, and the DataAdapter class is intended to help you to write those changes back to the database.
It sounds like the problem here is between the DataSet, DataAdapter, and the back end. So your best bet for assistance with something like that is Microsoft's documentation, since as I said, he grid plays no role in that part of things.
You probably have to use some kind of fake primary key in your DataSet/DataTable and then correct the key when you get a real key from the DataBase.
please, any ideas?