Conditional formatting not evaluating after cell change

Posted by: joni.dewinter on 2 August 2021, 9:09 pm EST

    • Post Options:
    • Link

    Posted 2 August 2021, 9:09 pm EST - Updated 30 September 2022, 2:41 am EST

    In Spread.NET V14 in ASP.NET MVC, when using conditional formatting, the rules don’t seem to evaluate upon cell changes. We use the following example (between 0-10), based on documentation:

    var celRange1 = new CellRange(0, 0, 4, 1);
    var between = new BetweenValuesConditionalFormattingRule(false, 0, false, 10, false)
        BackColor = Color.Bisque
    spread.Sheets[0].SetConditionalFormatting(new CellRange[] { celRange1 }, between);

    When filling in 15, the rule should not apply any color, but still does.

    Only if we save and/or reload the sheet, we evaluation is done and the rule color is applied:

    Is there any way to let the rule evaluate immediately? Thanks in advance.

    Kind regards Joni

  • Posted 3 August 2021, 6:29 pm EST

    Hi Joni,

    For this, You may need to use the Update method inside the EditStopped event. Please refer to the following code snippet and let us know if you face any issues.

            window.onload = function () {
                var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
                spread1.addEventListener("EditStopped", () => {

    API References:

    EditStopped: EditStopped | Spread ASP.NET 14

    Update method: Update | Spread ASP.NET 14

    Regards Avinash

  • Posted 4 August 2021, 2:45 am EST

    Hello Avinash

    The proposed solution seems to be a viable workaround for us, thanks. Is there any chance though that it will work in the future without this extra callback?

    Kind regards Joni

  • Posted 4 August 2021, 7:49 pm EST

    Hi Joni,

    This is by design changing the cell on the client-side will not be updated and evaluated until we call to save or call the update method.

    since this is the design calling the update method would be recommended for this functionality. Please let me know if you face any issues while using the suggested approach.

    Regards Avinash

  • Posted 4 August 2021, 8:03 pm EST

    Hello Avinash

    Thanks for the clarification, this topic can be closed as it’s working as designed then.

    Kind regards Joni

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels