I'm really sorry if my problem was discussed already. But i did not found an answer.
I have ultragrid which is bound to DataTable. One of the columns should support masked input, this datacolunm is type of string.
Entered data should have format "aaaaa/aa.aaaa", where 'a' is alphanumeric.
Here is short code example.
column.EditorComponent = new UltraMaskedEdit() { InputMask = "aaaaa\\/aa\\.aaaa", DisplayMode = MaskMode.IncludeBoth, ClipMode = MaskMode.IncludeBoth };
When the cell is in edit mode mask is shown. When the cell is not active - data are shown without mask. I've tried to set column.Format to "aaaaa\\/aa\\.aaaa", but unsuccessful.
If I do not set EditorComponent, but use column.MaskInput instead, then data from cell are stored with mask into DataTable.
Setting column.MaskDataMode to MaskMode.Raw has np effect.
Please help me to show my data with mask :)
Mike, thank you for your kind help. The problem was in my code, there was an event OnGridAfterExitEditMode that have corrupted my data. This was my stupid mistake.
Can I ask one more question. I know it is possible to set InputMask on each cell in the column (when mask depends on another cell value, for example). I've found disscussion how to do this using EditorComponent of the cell.
But in this case mask is not shown when the cell is not in edit mode. Can you help me?
I tried this out and MaskDataMode.Raw works just fine for me. I have attached my sample project here. In the sample there are two grids. The first grid has the mask applied to the string column and the second does not. The second grid is just there to display the raw data from the DataTable so you can see that the mask characters are not being saved.
If you edit a cell in the first grid, the first grid shows the mask but the second grid does not because the data is saved in Raw form.
Hi, Mike. Thank you for your answer.
I've tried your code, but it is not suitable for me, because string from cell is stored into my DataTable with mask symbols. Please look for attached figure.
I need raw data in my DataTable (without any /. ). Setting column.MaskDataMode to MaskMode.Raw has no effect.
Hi,
You are making this much more complicated than you need. :)
DisplayMode and ClipMode on the editor will have no effect on the grid column. Also, Format will not work on a String, since the String.ToString method doesn't support any formatting in DotNet.
You don't need an editor or a format for this.
All you need to do is set the properties for the mask directly on the column.
column.MaskInput = "aaaaa\\/aa\\.aaaa"; column.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeBoth;