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.
Unfortunately, activation email could not send to your email. Please try again.

SaveCellInfo Not firing

Thread ID:

Created:

Updated:

Platform:

Replies:

68842 Oct 3,2007 07:08 AM Oct 5,2007 02:36 AM Windows Forms 2
loading
Tags: GridControl
Stephen Main
Asked On October 3, 2007 07:08 AM

Hi,

My set up is:
-Inherited grid control that handles the SaveCellInfoEvent of the grid.
-Inherited GridFormulaCellModel and GridFormulaCellRenderer that formats the cell by setting the .Text property of the e.Style argument in OnPrepareViewStyleInfo method of the renderer.
-Custom cell model is registered as "MyType" in the grid.
-ForceSaveCellInfo of Engine is set to true.

My problem is this:
-I have a cell of type "MyType" with a formula say "=A1+A2"
-If I change A1 or A2 value of the formula does not change.

I have found the following:
-when the custom renderer is changed so that it does not set the .text property, the SaveCellInfo event of the grid fires for the formulae cell (when A1 or A2 is changed).
-when the custom renderer tries to set the .text property, the SaveCellInfo event of the never fires for the formulae cell.
-This seems to be the problem as the value I am using to set the formatted value in the renderer comes from a custom property that is set in the SaveCellInfo event. If it is not fired then it will always be the same.

Why? What am I doing incorrectly.

Note that the custom format I am trying to achieve is a percent format without the percent sign so that a cell with .value = 0.10 is displayed as "10.00".

Administrator [Syncfusion]
Replied On October 4, 2007 07:44 AM

I tried to set up a sample to see the problem you are describing. I derived the GridControl and overrode OnSaveCellInfo. I also derived the formulacellmodel and formulacellrenderer. In the renderer, I overrode OnPrepareViewStyleInfo and performed some trivial formatting there by changing e.Style.Text.

In my sample, I did not see a problem with the formula (=A1+A2) updating when you changed either A1 or A2. And grid.OnSaveCellInfo was also being hit.

Bu what I did see was that the renderer.OnPrepareViewStyleInfo was not being hit for the cell that held the formula =A1 + A2. So, the formatting done in OnPrepareViewStyleInfo was not applying to the cell holding the formula. (When I changed the non-formulacells, A1 or A2, OnPrepareViewStyleInfo was hit for these cells, but not for the cell containing the formula.)

Is this the problem you are referring too? If so, I think you can work around it by doing the formatting in the grid's DrawCellDisplayText event instead on teh renderer.OnPrepareViewStyleInfo. Attached is the sample with the renderer code set up to listen to the grid's DrawCellDisplayText. With this code, the formatting is seen in all the cells, A1, A2, and the cell holding the formula.

CustomFormulaRenderer.zip

Stephen Main
Replied On October 5, 2007 02:36 AM

Thanks Clay,

I have received a solution to this from your colleague Fahad in DirectTrac. The attached sample demonstrates my problem in that that the Save cell info event did not fire for the formula cell.

However if I replace the line:
(person.TestScorePercentage).ToString("00.00");

with:
e.Style.Text = e.Style.FormattedText;
e.Style.Text = (person.TestScorePercentage).ToString("00.00");

The event is successfuly celled. I have copied the explanation below:

------------------------
This is because the formula cell C3 requires input in the format of "=D3+D4".

For example , If you set e.Style.Text as e.Style.CellValue, Essential Grid will display the expected result .

Case 1: When e.Style.Text = e.Style.CellValue
Since C3 is a formula cell it receives input as "=D3+D4" , so we get the expected result.

Case 2 : When e.Style.Text = person.TestScorePercentage
C3 takes input as previous numeric value say 30 and not the formatted cell value.

So we format the e.Style.Text , desired result will be displayed.
------------------------

Hope this might save somebody else some hours.

Thanks,
Steve

SaveCellInfoProblem.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;