We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

get changed values in a row at the RowSaved event

Hello @ all
how can i get the changes values in a row,
i search for a methode these give me the changes back.
example:
Name Street City
First Test Teststr. Munich
Change Test Secondstr. Munich
------------------------------------
Diff to Save Secondstr.

regards Martin


5 Replies

AD Administrator Syncfusion Team November 19, 2007 12:12 PM UTC

Hi Martin,

Thank you for your interest in Syncfusion products.

Getting changed values in a row.

You can get the changed values in a row using TableControlCurrentCellEditingComplete or RecordValueChanged events of GridGroupingControl.

The following code snippet illustrates this.

Method I

[C#]
private void gridGroupingControl1_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)
{
Element el = e.TableControl.Table.DisplayElements[this.gridGroupingControl1.TableControl.CurrentCell.RowIndex];
if (el.Kind == DisplayElementKind.Record)
{
Record r = el.ParentRecord;
MessageBox.Show(r.ToString());
}
}

Method II
[C#]
private void gridGroupingControl1_RecordValueChanged(object sender, RecordValueChangedEventArgs e)
{
Record r = e.Record;
MessageBox.Show(r.ToString());
}

Here is a sample for your reference.

http://websamples.syncfusion.com/samples/Grouping.Windows/F69921/main.htm

Please let me know if you have any other queries.

Regards,
Jaya



MA Martin November 25, 2007 12:49 PM UTC

Hi Jaya,
thanks you for yours answer.
but this is not solution for my problem.
I use the "RowSaved"-Event in the Bounded Grid
like this:

Private Sub HauptGrid_RowSaved(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridRowEventArgs) Handles HauptGrid.RowSaved
If e.IsAddNew = False Then
For ColNo As Int32 = 1 To Grid.Model.ColCount
Grid.Model(e.RowIndex, ColNo).......?????????
Next
End If
End Sub

I need a methode, that give me the changes in each Cell, like this
If Grid (Row,Col).IsChanged Then
Debug.Print( Grid (Row,Col).Value)
End If

Please give me a solution.
Martin



AD Administrator Syncfusion Team November 26, 2007 07:31 AM UTC


Hi Martin,

Thanks for the update.

Retrieving row changes in DataBoundGrid

Please use the below code snippet to retrieve the changes done in each cell of the changed row in RowSaved event handler.

Private Sub gridDataBoundGrid1_RowSaved(ByVal sender As Object, ByVal e As GridRowEventArgs)
If e.IsAddNew = False Then
Dim cm As CurrencyManager = CType(Me.BindingContext(Me.gridDataBoundGrid1.DataSource, Me.gridDataBoundGrid1.DataMember), CurrencyManager)
Dim drv As DataRowView = CType(cm.Current, DataRowView)
Dim dr As DataRow = CType(drv.Row, DataRow)

For i As Integer = 0 To 2
Console.WriteLine(drv(i).ToString())
Next i
End If
End Sub

Here is a sample for your reference.

http://websamples.syncfusion.com/samples/Grid.Windows/F69921/DataboundGrid/main.htm

Please let me know if this helps.

Regards,
Jaya



MA Martin November 28, 2007 06:57 PM UTC

Hi Jaya,
thanks you for yours another answer.

Yes this looks good, but I still have one question, I need only the changed values.
It is, possible that I get only this changed values?

Thanks
best regards Martin






AD Administrator Syncfusion Team November 29, 2007 09:29 AM UTC

Hi Martin,

Thanks for the update.

There is no direct such method to retrieve only the changed values in a cell. But as a workaround, you can compare the saved values with old values and extract the modified data using String manipulations.

Please let me know if you have any other queries.

Regards,
Jaya


Loader.
Live Chat Icon For mobile
Up arrow icon