Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mikkel Johansen 116 posts 292 karma points
    May 18, 2011 @ 17:06
    Mikkel Johansen
    0

    Cannot split values from UltimatePicker with less than 8 items

    Umbraco 4.7

    I have an UltimatePicker (checklist), when there is check 1 to 7 checked items a strange thing happens in Razor - It works fine in XLST. The seperator (,) is removed when I try to get the value from the property.

    Debugging I can see in the PropertiesAsList that the value is "1964,1965,1966,1967,1968,1969,1970"

    Doing a: var temp = node.propertyname;
    Results in "1964196519661967196819691970"

    If there is 8 or more in the list, the seperator (,) will not be removed.

    Code

    var node = @Model.NodeById(2603);
    string s = node.productgroups; //productgroups is a property of UltimatePicker

    Debug error message is that decimal cannot be converted to string. So "node.productgroups" returns decimal when less than 8 items and string when more than 7 items.

    Is this a bug or a special feature. Has anybody else this problem?

     

    - Mikkel Johansen

     

     

  • Alex 78 posts 136 karma points
    May 18, 2011 @ 18:14
    Alex
    0

    It is caused by the DynamicNode duck typing your value as an Int. 

    Try using the GetProperty method to work around the problem.

    string s = node.GetProperty("productgroups");
Please Sign in or register to post replies

Write your reply to:

Draft