This is a migrated thread and some comments may be shown as answers.

End edit of current cell

1 Answer 219 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Fernando
Top achievements
Rank 1
Fernando asked on 22 Oct 2014, 02:54 PM

Hello,

I have an application with a radspreadsheet and a button. When i click the button with the cell in edit mode (i have the cursor of the mouse inside it) i cant get the new value of the cell. Is there any way to end the edit mode of the current cell?.

When i write on C2 "1" ,exit the cell and click on save i get "1".


Then, when i write on C2 "2" , and click on save without exit the cell i still get "1" instead of "2".


Thanks!














1 Answer, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 24 Oct 2014, 07:59 AM
Hi,

In order to end the edit mode of the cell, you can use the ActiveCellMode property of the Selection class.

RadWorksheetEditor editor = this.radSpreadsheet.ActiveWorksheetEditor;
editor.Selection.ActiveCellMode = ActiveCellMode.Display;

This, however, will not confirm the currently entered value in the cell editor. You would have to get the text from the cell editor and set it to the current cell. Then your code will look similar to this:

RadWorksheetEditor editor = this.radSpreadsheet.ActiveWorksheetEditor;
WorksheetUILayerBase inputLayer = editor.ActivePresenter.UILayers.GetByName(WorksheetPredefinedUILayers.CellInput);
string currentInput = (inputLayer as CellInputUILayer).CellEditor.Text;
 
editor.Selection.ActiveCellMode = ActiveCellMode.Display;
editor.Selection.ActiveCell.SetValue(currentInput);


I hope this helps.

Regards,
Anna
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Spreadsheet
Asked by
Fernando
Top achievements
Rank 1
Answers by
Anna
Telerik team
Share this question
or