Range Validator

Posted by: amulya.verma on 28 September 2021, 7:06 pm EST

  • Posted 28 September 2021, 7:06 pm EST

    Hi All,
    How to implement below code for range validator can you give me some working example code

    FarPoint.Win.Spread.CellStyleNotify stylenotify = new FarPoint.Win.Spread.CellStyleNotify();
    stylenotify.InvalidCellStyle.BackColor = Color.Aquamarine;
    FarPoint.Win.Spread.RangeValidator rvalid = new FarPoint.Win.Spread.RangeValidator();
    rvalid.MaxValue = 10;
    rvalid.MinValue = 0;
    rvalid.Actions.Add(stylenotify);
    fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), rvalid);
  • Replied 30 September 2021, 9:08 pm EST

    Hi,

    Your code is correct. This shows specified cell style when an invalid value is input.
    However, please note that this style is only shown when the cell is in editing.

    I guess you are expecting the given style to apply even after the cell goes out of edit mode.
    For this, you should use Conditional Formatting:
    https://www.grapecity.com/spreadnet/docs/v14/online-win/spwin-interact-condition.html

    Regards,
    Jitender
Need extra support?

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

Learn More

Forum Channels