Copied to clipboard

Flag this post as spam?

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


  • Thomas T 66 posts 227 karma points
    Feb 21, 2015 @ 07:32
    Thomas T
    0

    Partial View did not work

    In my site, homepage did not load. All other pages working fine. I used partial view  in homepage to show banner images which are under media section. When I delete those images in content node, then homepage is loaded..If not it shows error like below,

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 21, 2015 @ 08:28
    Jan Skovgaard
    0

    Hi Thomas

    Could you please share your code from the partial macro? It will make it easier to figure out why you're getting the above error. Perhaps you're missing a check or something like that.

    /Jan

  • Thomas T 66 posts 227 karma points
    Feb 21, 2015 @ 08:47
    Thomas T
    0

    Hi Jan, 

     This is my code in Partial View.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{

       var mediaFolderId = (int)CurrentPage.BannerMediaFolder;

    }@if (mediaFolderId > 0)

    { var mediaFolder = Umbraco.TypedMedia(mediaFolderId);

       var banners = mediaFolder.Children(x => x.DocumentTypeAlias == "Banner").ToList();

       var count = 0;

    var dscname = "";

     

    @foreach (var banner in banners)

        {if(count == 0)

    { dscname = "active" ; }

           

    •  

     

    dscname = "";

    count++; }

    }

     

Please Sign in or register to post replies

Write your reply to:

Draft