Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 662 karma points
    Oct 13, 2017 @ 07:51
    Martin
    0

    Multi Url Picker + Doc Type Grid Editor

    Hi All,

    Im having an issue with my partial view for a button. I had created a button using the Multi URL Picker & Doc Type Grid Editor.

    I have previously got it working, but the code has issues now that packages have been updated.

    Im getting the error:

    System.NullReferenceException: Object reference not set to an instance of an object.

    Im using Umbraco 7.7.2, Multi Url Picker 2.0.1, DTGE 0.4.0.

    Any help would be appreciated.

    Martin.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using RJP.MultiUrlPicker.Models;
    
    
    @{
      var button = Model.GetPropertyValue<MultiUrls>("buttonConfig");
      if (button.Any())
      {
          foreach (var item in button)
          {
            <a class="button" href="@item.Url" target="@item.Target">Explore</a>
          }
      }
    }
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Oct 20, 2017 @ 20:24
    Alex Skrypnyk
    0

    Hi Martin

    Are Property Value Converters enabled?

    If yes, this code should work:

    foreach (var item in Model.ButtonConfig)
          {
            <a class="button" href="@item.Url" target="@item.Target">Explore</a>
          }
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Nov 01, 2017 @ 13:02
    Alex Skrypnyk
    0

    Hi Martin

    Did you solve the issue? Share with our community, please )

    Thanks,

    Alex

  • Martin 278 posts 662 karma points
    Nov 02, 2017 @ 09:58
    Martin
    100

    Hi Alex,

    Yeah sure. For a single url you need to use <Link> instead of <MultiUrls>

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using RJP.MultiUrlPicker.Models;
    
    
    @{ 
        var button = Model.Content.GetPropertyValue<Link>("gridButton");
    }
    
    @if(button != null)
    {
      <a class="button" href="@button.Url" target="@button.Target">@button.Name</a>
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft