Copied to clipboard

Flag this post as spam?

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


  • Matthew 138 posts 201 karma points
    Apr 21, 2014 @ 20:12
    Matthew
    0

    foreach gallery partial view, count displays twice

    v.7.1.1, I have this gallery partial view and the h3 tag at the end displays twice.  tried moving it around in the partial, hasn't helped.  help?

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @if (Model.Content.HasValue("galleryImages"))
    {
        var imagesList = Model.Content.GetPropertyValue<string>("galleryImages").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse);
        var imagesCollection = Umbraco.TypedMedia(imagesList).Where(x => x != null);
        var n = 0;

        <div class="row">
            <div class="col-xs-12 col-sm-9">
                <h3>@Model.Content.GetPropertyValue("title") image gallery</h3>
                <div class="fotorama" data-width="1000" data-thumbwidth="100" data-nav="thumbs">
                    @foreach (var imageItem in imagesCollection)
                    {
                        n = n+1;
                        <img src="@imageItem.Url" data-caption="@imageItem.GetPropertyValue("caption")" />
                    }
                </div><!-- end fotorama -->

    <!-- THE OFFENDING H3 TAG -->
                <h3>There are @n images in the @Model.Content.GetPropertyValue("title") image gallery</h3>

            </div><!-- end col -->
        </div><!-- end row -->
    }

     

  • Matthew 138 posts 201 karma points
    Apr 21, 2014 @ 20:22
    Matthew
    0

    ok, now it's not, dunno why but nevermind...

  • Matthew 138 posts 201 karma points
    Apr 21, 2014 @ 20:55
    Matthew
    0

    doh!  it was working fine then I went into the media section and deleted an image and now it's throwing an error:

    System.FormatException: The valueDictionary is not formatted correctly and is missing any of the  'id,nodeId,__NodeId' elements

    Line 17:                 @foreach (var imageItem in imagesCollection)
    Line 18:                 {
    Line 19:                        n = n += 1;
    Line 20:                        <img src="@imageItem.Url" data-caption="@imageItem.GetPropertyValue("caption")" />
    Line 21:                 }

    if I pull that line 19 out, it gives the same error but indicates line 18 , the '}', is the problem.

    following the comments in the api forum, http://our.umbraco.org/forum/developers/api-questions/44851-Issue-With-Media-Cache-in-v6?p=1, I republished the site, then the specific page, then it seems to be fixed, for now.

    Kinda funky.  Is this already an issue?

Please Sign in or register to post replies

Write your reply to:

Draft