Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1470 posts 3427 karma points c-trib
    Sep 03, 2013 @ 12:56
    Simon Dingley
    0

    UrlPicker null when using Model.GetPropertyValue<UrlPickerState>("MyProp") in Umbraco v6.1.4

    Not sure if this is a bug or incompatability with this version of Umbraco but take the following code:

    contentItem.GetPropertyValue("link")
    

    This returns the following data:

    <url-picker mode="Content">
      <new-window>True</new-window>
      <node-id>1134</node-id>
      <url>/events/</url>
      <link-title>Example Banner</link-title>
    </url-picker>
    

    However, the following code returns a null value:

    contentItem.GetPropertyValue<UrlPickerState>("link");
    

    Am I going the wrong way about this?

    Thanks, Simon

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Sep 03, 2013 @ 13:59
    Jeroen Breuer
    100

    Hello,

    The UrlPickerState is not a Property Editor Value Converter so that won't work.

    Try this:

    var urlPickerState = UrlPickerState.Deserialize(content.GetPropertyValue<string>(alias));

    Jeroen

     

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Sep 03, 2013 @ 14:00
    Simon Dingley
    0

    Thanks and marked as solution as discovered this earlier and implemented.

Please Sign in or register to post replies

Write your reply to:

Draft