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;
Hi Josh,
This seems like it should work. The only thing I can think of is that this might be a timing issue. In what event is the code you have here?
That's what I thought! :) All of that code is in an initialization step after the grid has been added to the form. I've verified with the debugger that the MaskDisplayMode and everything is set properly at runtime. The cell's value is assigned in the same method. I've tried assigning the value to the cell both before and after assigning the editor, and the behavior is identical.
Josh U
Well, I recommend creating a small sample project demonstrating this and then you can Submit an incident to Infragistics Developer Support so they can take a look. We must be missing something here.
I can verify that in version 2009 Vol1, this code works perfectly. Just in case someone is browsing for an answer but using a newer version.