Posted 19 September 2019, 3:30 am EST
I am working on a migration of a windows Forms application from version 2005 i.e. .NET2.0 to 2015 i.e. .NET4.5. Original code uses FarPoint Spread v2.5. Now I am trying to use version 11 of FpSpread control.
I have a form with editable grid. It’s an order details entry form. Apart from regular Text, numeric and date cells I need to use cells with combo box and button CellTypes. Since I need some peculiar functionality in combbox, I am using a custom cell type for combobox and for button I am using ButtonCellType. But I am facing an issue with celltypes.
I do set CellTypes in 3 different types of rows on different events.
- Form Load event - here I set CellTypes in a row that was created at design time. Both the CellTypes work fine. The dropdown gets opened on click and the ButtonClick event gets fired when clicked on the button cell.
- On a Refresh button click - I remove all the records from grid and add a new record using DefaultSheetDataModel AddRow method and then set CellTypes. It works fine. But the moment I remove the code from FormLoad that sets the CellTypes, it just stops working. When I click the cell, it shows cursor inside the cell instead of showing dropdown items or firing button click event. Both cells appear to be normal editable cells.
- On Add New button click - I add one more row in the grid at the last position and set CellTypes calling the same code that I use in FormLoad and Refresh. But still the CellTypes never work for this record. The cells keep on appearing to be normal editable cells and cursor is shown inside
I am using the same functions for setting CellType in all 3 cases.
The code from Form Load is not actually required. But #2 doesn’t work if I do not have that code, which is really weird
#3 never works as expected
One more thing to be noted is – I perform all the grid operations using this data model. The original code heavily depends upon the DefaultSheetDataModel.
All this functionality was working absolutely fine in original version.