RadGridView get new value

2 Answers 61 Views
GanttView
Jarne
Top achievements
Rank 2
Iron
Jarne asked on 13 Sep 2024, 09:14 AM

I have a question about the RadGridView

I want to retrieve the new value of a cell that I have changed.

When I change a cell from value "AB" to "CD", how can I then get "CD" ?

Should I use the RowsChanged or CellValueChanged event?

In the RowsChanged, you have a property e:NewItems, but I don't know how you then can get value "CD" from e:NewItems.

2 Answers, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 16 Sep 2024, 01:10 PM

Hello, Jarne,

In order to get the new value after a cell is being edited you should subtribe to CellValueChanged event. This event fires when a value in cell has changed and I believe it would be suitable for your scenario. From its GridViewCellEventArgs you have access to the e.Value property which will give you the new value in cell:

private void RadGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
{
    var val = e.Value;
}

On the other hand, RowsChanged event fires after one or more grid rows are changed. More information about tracking changes in RadGridView you can find here: Tracking changes in RadGridView - RadGridView - Telerik UI for WinForms

I hope this helps. If you have any further questions, please let me know.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Jarne
Top achievements
Rank 2
Iron
answered on 16 Sep 2024, 02:15 PM

Hello Nadya,

Thank you, now it works.

The problem in my case was that I forget to update the ProBindingSource behind the RadGridView.

I had to set the bindingSource.AutoUpdate property to True to get it working.

When you define a ProBindingSource the AutoUpdate property is false.

And then I was able to retrieve the new value with e.Value.

Nadya | Tech Support Engineer
Telerik team
commented on 17 Sep 2024, 08:24 AM

Hello, Jarne,

I’m glad to hear that everything is working correctly now on your side. If you have any more questions or need further assistance, do not hesitate to contact me. 

Tags
GanttView
Asked by
Jarne
Top achievements
Rank 2
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Jarne
Top achievements
Rank 2
Iron
Share this question
or