Hi,
I have a requirement to support data validation within my editor control. To support this I've created a -class -which derives from Infragistics.Win.EditorWithMask.
I attach this editor to the appropriate grid cell when the Grid row is initialized. I configure it to display the mask - DisplayFormattedTextWhenNotFocused = true
In the InitializeRow event, I set this custom editor into the cell.
Cell.Editor = mUnitNoEditorCell.Column.MaskInput = "AAA\.AA\.AA"
In the InitializeLayout of the grid, I set this column up to return all characters :
.UseEditorMaskSettings = True -(edit- ' my first mistake).MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth.MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth
And yet, I only see the mask when I am editing the cell. When the cell is not actively edited, the mask characters are removed.
This is not what I want. I want to see the mask and the characters at all times and I want the value of the column to be this as well. ( It is this when I set the value, but the mask characters are stripped out)
Please tell me where I've gone wrong. Thanks.
Edited: Summary of where I went wrong, (BTW - very frustrating experience with the half-there half-not there help docs and all the many control choices available - Why Me Lord.)
perrb01 said:I must provide validation within this control, not within the grid. The control is Enterprise level and the grid is project level.
I don't believe this is possible. Or at least, it cannot be combined with also using a different mask in each cell.
Perhaps what you can do is provide some Enterprise level methods that the project can call into to validate the values.
Who's Mark? :)
perrb01 said:How do I add the UltraMaskedEdit as an Editor to my column. - Please if you would be so kind - provide Sample Code.
Make sure you are using the EditorControl property, not the Editor property of the column.
Mark, I must provide validation within this control, not within the grid. The control is Enterprise level and the grid is project level.
Thanks, Mark.
How do I add the UltraMaskedEdit as an Editor to my column. - Please if you would be so kind - provide Sample Code.
This would be my preferred method, I did attempt it more than once.
When I do it the way I think it should be done, I am informed it doesn't support the correct interface.
The mask comes from the owner, not the editor.
So if you need a different mask in each cell of the same column, there are a number of ways you can do it. The easiest way it to use an EditorControl (UltraMaskedEdit) instead of just an editor (EditorWithMask). The control has properties for the masks, just like the grid column does. So if you set the column's UseEditorMaskSettings and assign the cell's EditorContorl to an UltraMaskedEdit control, it will pick up the mask settings of the control.
But, this may not work for you and whatever validation you are trying to achieve by deriving a class from the editor, since the control will provide an editor to the grid. Which is why I asked for more details about what, exactly you are trying to achieve.
Most likely, you will not be able to do your validation on the editor level, you will have to do it using events of the grid.