Search code examples
c#umbraco6

Get value of umbraco datatype in code


I have created a checkbox list type of data type in umbraco. see below screen shot enter image description here

I am able to get the text value of this data type which is "All" in this case. But I am unable to get the Value in code.

umbraco.library.IProperty property = node.GetProperty("countries");
string val = property.Value;

I also looked at all the property fields but Value of this is not available. Any one has any idea I am using Umbraco 6.2.4


Solution

  • Looks like you should be using the GetPreValueAsString for your soultion.

    string val = umbraco.library.GetPreValueAsString(node.GetProperty<int>("countries"));