property textstring numeric characters automatically convert to real number
Hi,
I have a textstring property where I put some version numbers in it (e.g. "1.0"). When I query the model I noticed that somehow automatically the string is regarded as a number, because the value appears as "1" (without the . and 0) on the page. In the model cs file I can see that the property is generated as type of object. This may be the reason. But how could this be solved?
If using models builder that's a bit strange, but would take a look at the type it has created and change the model (depending what mode you're running) - need more info from you here.
property textstring numeric characters automatically convert to real number
Hi,
I have a textstring property where I put some version numbers in it (e.g. "1.0"). When I query the model I noticed that somehow automatically the string is regarded as a number, because the value appears as "1" (without the . and 0) on the page. In the model cs file I can see that the property is generated as type of object. This may be the reason. But how could this be solved?
Kind regards, Stephan
Hi Stephan,
This probably depends on how you're retrieving the property. Are you using models builder or using GetPropertyValue() ?
You can specify a type with GetPropertyValue eg
If using models builder that's a bit strange, but would take a look at the type it has created and change the model (depending what mode you're running) - need more info from you here.
HTH, David
Hi David,
Forgot to mention that the textstring comes from a custom property editor. I forgot to implement a Property Value Converter. That was the reason. Now everything works fine. Here's the documentation (https://our.umbraco.com/documentation/Extending/Property-Editors/value-converters) and my implementation below:
is working on a reply...