Sorry I'm not 100% sure about your first question, but your second issue sounds like Razor is doing some strange casting. It's possible that may be fixed in 4.7.1.1.
One solution/workaround would be to use Model.GetProperty("alias").Value instead of Model.alias - the first one will always return a string, the second one it tries to cast which is probably where your issue is happening.
Another solution I was going to suggest is that you can write a RazorDataTypeModel with your DataType, then you can have Model.alias automatically return something like a List<int> or even List<DynamicNode>...but I think you won't be able to do this with the usercontrolwrapper since it works off the datatype's GUID (which will be the same for all usercontrol datatypes).
usercontrol datatype save without CDATA + render issue
Hello everyone.
I am using umbraco 4.7.1 , make some umbraco usercontrol wrapper datatype.
in my user control i have that code for saving the prtoperty..
public object value
{
get
{
return SomeHiddenFieldId.Value;
}
set
{
umbracoValue = value.ToString();
}
}
in umbraco.config the property saved like this :
<alias><![CDATA[1266,1227]]></alias>
There is a way to avoid this CDATA?
i want it will be like this :
<alias>1266,1227</alias>
Another issue - when i try to use this propery in macro for some reason if there is only two items
( the property is holding some id's ) it is look like this :
TWO ITEMS :
in umbraco.config : <alias><![CDATA[1266,1227]]></alias>
in macro : <p>@item.alias.ToString()</>
result : 12661227 ( without the comma )
THREE ITEMS :
in umbraco.config : <alias><![CDATA[1266,1227,1244]]></alias>
in macro : <p>@item.alias.ToString()</>
result : 1266,1227,1244 ( good! )
Thanks in advance.
Hi,
Sorry I'm not 100% sure about your first question, but your second issue sounds like Razor is doing some strange casting. It's possible that may be fixed in 4.7.1.1.
One solution/workaround would be to use Model.GetProperty("alias").Value instead of Model.alias - the first one will always return a string, the second one it tries to cast which is probably where your issue is happening.
Another solution I was going to suggest is that you can write a RazorDataTypeModel with your DataType, then you can have Model.alias automatically return something like a List<int> or even List<DynamicNode>...but I think you won't be able to do this with the usercontrolwrapper since it works off the datatype's GUID (which will be the same for all usercontrol datatypes).
HTH,
Tom
Hi Tom.
Thanks for the quick response.
the first solution ( GetProperty.("alias") ) sloved the issue.
Fabulous. Thanks!
Anyone about the CDATA issue??
is working on a reply...