Copied to clipboard

Flag this post as spam?

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


  • Melanie Rohr 7 posts 28 karma points
    Mar 24, 2015 @ 23:11
    Melanie Rohr
    0

    Multi Url Picker throwing null reference exception

    I'm trying to use this Multi Url Picker but can't seem to get it to work. I've installed the package from the repository and followed the example code but get a System.NullReferenceException: Object reference not set to an instance of an object. Using Umbraco 7.1.8.

    Any ideas?

     

  • Valerie 67 posts 163 karma points
    Mar 25, 2015 @ 11:57
    Valerie
    0

    Can you paste the code you are using? Which line does the null reference happen on? Does it blow up before you have retrieved any items?

    I'm using it in 7.1.8 and it's fine. Here's a gist of my code

    https://gist.github.com/anonymous/fe8f03f1a9ade0bc2b9d

     

     

  • Melanie Rohr 7 posts 28 karma points
    Apr 01, 2015 @ 20:27
    Melanie Rohr
    0

    I'm using the razor code example from the projects page like so:

    @using RJP.MultiUrlPicker.Models
    @{ var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("myPropertyAlias"); if (multiUrlPicker.Any()) { <ul> @foreach (var item in multiUrlPicker) { <li><a href="@item.Url" target="@item.Target">@item.Name</a></li> } </ul> } }
  • Melanie Rohr 7 posts 28 karma points
    Apr 02, 2015 @ 21:40
    Melanie Rohr
    0

    Finally figured it out! Totally my bad!The code was nested in an if statement and I had totally referenced it wrong :(

     

Please Sign in or register to post replies

Write your reply to:

Draft