I have the following string: "10222002750400447092095835"
I want it to be displayed like this: 10 2220 0275 0400 4470 9209 5835
I tried doing the following, with no result at all:
[DisplayFormat(DataFormatString = "{0:00 0000 0000 0000 0000 0000 0000}", ApplyFormatInEditMode = true)]
or
[DisplayFormat(DataFormatString = "{0:## #### #### #### #### #### ####}", ApplyFormatInEditMode = true)]
What am I doing wrong?
String.Format("{0:## #### #### #### #### #### ####}", "10222002750400447092095835");. The problem is exactly in the argument - its a string, and string is not IFormattable. But how can i omit that? This argument needs to be a string.IFormattableyourself in order to use custom formats. See also stackoverflow.com/a/10512433/63733