Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
Multiple conditional formatting in a grid cell
posted

Anyone know how to get multiple conditional formatting to work in a grid cell?

 

Example: In our product, a zip code can be 5 digits, 9 digits with a dash, and alphanumeric (Canadian).  A Mask will not work for this situation, and it seems I can only set a format on a column, and cannot conditionally format a cell differently.  We do not want to store the dash in the 9 digit case, so it needs to be a format only, not a modified underlying value.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

        What you need to do is use an editor - or rather three editors. What you would do is create 3 UltraMaskedEditor controls on your form with the grid. You would set up one to have a 5-digit zip code mask, another to have 9 digits, and the last to handle Canadian. Then you use the InitializeRow event of the grid to set the EditorControl property of the Cell to the appropriate MaskedEditor control that has the mask you want.

        In itself, the above won't work, because the grid mask settings take precedence over the editor. So you also need to use UseEditorMaskSettings on the column to true.

Children