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
40
Masked text in display mode
posted

   In our application, we need to be able to arbitrarily assign a different text mask at the cell level.  We're doing this by assigning an EditorWithMask to the cell's Editor property.  All is well in edit mode, but if we assign "1234567890" to the cell's Value, that's exactly what we see instead of "123-456-7890" (with the editor's mask being "###-###-####") until we enter edit mode.  I've set the column's UseEditorMaskSettings to true.
   I've tried doing a hack by setting UseEditorMaskSettings to false, temporarily setting the column's masking properties and then use Cell.GetText(MaskMode.IncludeLiterals), but the mask is not applied.  There must be something that I am missing in my code.  I appreciate any suggestions.

Thank you,
Josh U

Here's a code snippet:
 DefaultEditorOwnerSettings settings = new DefaultEditorOwnerSettings();
settings.MaskInput = CurrentItem.InputMask;
settings.Format = CurrentItem.InputMask;
settings.MaskDataMode = MaskMode.IncludeLiterals;
settings.MaskDisplayMode = MaskMode.IncludeLiterals;
settings.DataType = typeof(string);
CurrentCell.Editor = new EditorWithMask(new DefaultEditorOwner(settings));
CurrentCell.Column.MaskDisplayMode = MaskMode.IncludeLiterals;