Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
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.
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:
public class MyTextboxPropertyConverter : IPropertyValueConverter
public object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
public object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
public object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview)
public bool IsConverter(PublishedPropertyType propertyType)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted