Hello,
We recently went through two upgrades. The first was upgrading from .NET Framework 4.7.2 / Infragistics 18.2 to .NET 6 / Infragistics 22.1, and the second was upgrading from Infragistics 22.1 to 23.1.111.
I'm not sure at which point this behavior changed, but we used to be able to set UltraGridCell.Value and the corresponding bound DataRow.RowState would change from Unchanged to Modified. Now when we set UltraGridCell.Value, we see the DataRow.Item value change as expected but the RowState remains Unchanged.
I've attached a sample project that demonstrates this discrepancy. As a workaround we're trying to change our code to set the DataRow.Item value directly but it's difficult to find everywhere that needs to be changed.
Any suggestions would be appreciated.
GridCellValueToRowStateBug.zip
Hello and thank you for contacting Infragistics. I created a .NET framework 4.7.2 vb sample using Infragistics 18.2.130 and I see the same behavior as in your attached sample. I am not aware of any changes in this area of the API as I did a search in our system and found no changes in the last 10 years. Please modify my sample to replicate the desired behavior so I may compare this with your test application.
8507.WindowsApp1.zip
Thanks very much for the quick response, and you're absolutely right. I assumed that this was new behavior simply because we ran into it after the upgrades, but now that I created a .NET Framework 4.7.2 / Infragistics 18.2 project I see that it's the same behavior.
I do find it odd that the DataRow is somehow updated while still reflecting a RowState of Unchanged, but since this is not new behavior as I originally assumed it's probably not worth trying to change. We'll just try to remember that when RowState matters, we can't set the cell value directly but instead must set the value in the DataRow.
I apologize for the confusion. Thanks again for all your help Michael!
Please make the table global and then you can call
table.AcceptChanges()
Then when you click the second button it will display the rowstate as modified.
Public Class Form1 Dim table As New DataTable Private Sub UltraButton1_Click(sender As Object, e As EventArgs) Handles UltraButton1.Click Me.UltraGrid1.Rows(0).Cells(0).Value = "Value after setting UltraGridCell.Value" MessageBox.Show("RowState = " & DirectCast(Me.UltraGrid1.Rows(0).ListObject, DataRowView).Row.RowState.ToString) table.AcceptChanges() Debug.WriteLine(table.Rows(0).RowState) End Sub Private Sub UltraButton2_Click(sender As Object, e As EventArgs) Handles UltraButton2.Click DirectCast(Me.UltraGrid1.Rows(0).ListObject, DataRowView).Row.Item(0) = "Value after setting DataRow.Item(0)" MessageBox.Show("RowState = " & DirectCast(Me.UltraGrid1.Rows(0).ListObject, DataRowView).Row.RowState.ToString) table.AcceptChanges() Debug.WriteLine(table.Rows(0).RowState) End Sub Private Sub UltraButton3_Click(sender As Object, e As EventArgs) Handles UltraButton3.Click Me.Reset() End Sub Private Sub Reset() table.Columns.Add("Column1", GetType(String)) table.Rows.Add("Initial value") table.AcceptChanges() Me.UltraGrid1.DataSource = table End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Reset() End Sub End Class