Hello,
I´m using "Infragistics NetAdvantage for .Net 2008 Volume 3 CLR 2.0". In my application i have an ultraGrid. The DataSource is directly bound to an DB.
Now I must enter an IP-Addresse in one Cell likte this: "192.168.10.155".
The MaskInput-Property I have set to "nnn\\.nnn\\.nnn\\.nnn". It the looks pretty good in edit mode. But the same string doesn´t work for Format-Property. I also have no range limit (the max value for every number should be 255, eg. "255.255.255.255").
How can I program this? Is there an easy solution to enter and show an IP-Address? Something like an control I can add to the cell?
The data-format of the DB of the cell is actually an string, but it can be changed.
I would be greatful of any help. Thanks
Hi,
MaskInput only applies when the cell is in edit mode. Hence the word "Input". :)
Typically, what you would do is use MaskInput for the input mask when the cell is in edit mode and use the Format property of the column to control the display when the cell is not in edit mode.
Format won't work for you in this case, though, for two reasons. First, the string data type doesn't support any formatting. And second, there are no numeric formats in DotNet, as far as I know, that can handle multiple decimal points like for an IP address.
So what I recommend is that you set the MaskDisplayMode on the column to MaskMode.IncludeLiteralsWithPadding.
Hello Mike,
thanks for your quick reply.
Since the last answer from you I know how to use "MaskInput" and "Format".
Now I made it. When the cell is in edit mode, the cell is formatted to enter 4 numbers. Before leaving edit mode, i check if the numbers are correct. Then I write the new value as a string in the DB and set the MaskDisplayMode = MaskMode.IncludeBoth. It then looks so:
Edit mode: _ _ _ . _ _ _ . _ _ _ . _ _ _ (4 numbers with 3 positions each, seperated with a dot)
not in Edit mode eg. 192.168.010.055 (formatted as a string)
Thanks for your help