Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Mar 19, 2015 @ 10:07
    Claushingebjerg
    0

    RemoveEmptyEntries not working

    Im having a bit of trouble with a list of media items, where the editor deletes the file from the medialibrary. It should then stop appearing in the list, but it stays there as an empty reference. So it seems "RemoveEmptyEntriest" doesn't kick in... Any idea what i may be doing wrong? 

    Code:

    @{
      if (fieldset.HasValue("filer"))
      {
      var boxListValue = fieldset.GetValue<string>("filer");
      var boxList = boxListValue.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
      <ul>
      @{ 
          foreach (var item in boxList)
          {
          <li><a href="@Umbraco.Media(@item).Url" target="_blank">
                @Umbraco.Media(@item).Name</a>
            </li>
            }   
        }       
        </ul>
        }
    }
  • Claushingebjerg 939 posts 2574 karma points
    Mar 19, 2015 @ 12:35
    Claushingebjerg
    0
    var boxListValue = fieldset.GetValue<string>("filer");
    var boxList = boxListValue.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
    var ImagesCollection = Umbraco.Media(boxList);

    fixed it.

Please Sign in or register to post replies

Write your reply to:

Draft