RadSpreadsheet cell value changed event

1 Answer 22 Views
Spreadsheet
Jarne
Top achievements
Rank 2
Iron
Jarne asked on 07 Oct 2024, 03:00 PM

I have for with a radspreadsheet on. ( Telerik.WinControls.UI.RadSpreadsheet )

Which event do I need to use to capture a change in a cell?

For example, if I change cell A2 from value "ABC" to "EFG", how can I get the value "EFG" ?

If I check the documentation: then the CellPropertyChanged event exists, but I cannot find this in my IDE.

Why are the events that I have in my radSpreadSheet different then the documentation? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 08 Oct 2024, 11:11 AM

Hello, Jarne,

CellPropertyChanged event is relevant for the cells in RadSpreadsheet control, hence it is accessible through the Cells collection. If you need to track when the cell value has changed, you can subscribe to the CellPropertyChanged event and watch for "e.Property = CellPropertyDefinitions.ValueProperty" inside it.

Please refer to the following code snippet that demonstrates how to access the CellPropertyChanged event and then track for ValueProperty:

this.radSpreadsheet1.SpreadsheetElement.ActiveWorksheet.Cells.CellPropertyChanged += Cells_CellPropertyChanged;
private void Cells_CellPropertyChanged(object sender, Telerik.Windows.Documents.Spreadsheet.PropertySystem.CellPropertyChangedEventArgs e)
{
    if (e.Property == CellPropertyDefinitions.ValueProperty)
    {
     // value changed
    }
}

I hope this information is useful. If you have any other questions do not hesitate to ask. 

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.

Jarne
Top achievements
Rank 2
Iron
commented on 08 Oct 2024, 12:28 PM | edited

Thank you. After reading some documentation I now solved my question.

I was able to get the value "EFG" from e.CellRange.FromIndex.

if (e.Property == CellPropertyDefinitions.ValueProperty)
{
    CellIndex cCellindex = e.CellRange.FromIndex;
    RangePropertyValue<ICellValue> rangeValue = radSpreadsheet1:ActiveWorksheet.cells[cCellIndex].GetValue();
    ICellValue cValue = rangeValue.VALUE;
    string realValue = cValue.RawValue;  
}

 

Nadya | Tech Support Engineer
Telerik team
commented on 09 Oct 2024, 10:32 AM

Hello, Jarne,

I am glad to hear that you managed to find how the get the value from cell. Thank you for sharing your code snippet!

I am posting here the documentation article about working with Value property. I believe it might be useful if other clients are searching on the same topic: SpreadProcessing - Cell Value Types - Telerik Document Processing

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