Copied to clipboard

Flag this post as spam?

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


  • Wael 5 posts 96 karma points
    Apr 06, 2019 @ 23:14
    Wael
    0

    All partial views items are the same when using Nested Content in Partial view

    I'm trying to make a webticker as a partial view which will take its settings and items from a document type under the parent page but all partial views has the same nested content items as the first request (all other properties are working fine).

    @{
        var mainWebticker = Umbraco.Content(Guid.Parse("bae542f8-5769-4eb3-aa39-d5e0b6b675e9"));
    }
    
    @Html.Partial("Webticker", mainWebticker)
    
    @{
         var webticker2 = Umbraco.Content(Guid.Parse("a6fa8c8e-fd5c-4b4f-b9e0-f324dcc053cc")); 
    }
    
     @Html.Partial("Webticker", webticker2 )
    

    So what am I doing wrong?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 07, 2019 @ 21:32
    Alex Skrypnyk
    1

    Hi Wael

    Can you show code of the partial view?

    Alex

  • Wael 5 posts 96 karma points
    Apr 07, 2019 @ 22:02
    Wael
    0

    The following is a portion of it because its too long:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    
    @if (!Model.Value("type").Equals("carousel"))
    {
        @:<div id="@Model.Name.Replace(" ", "-")" class="webticker">
    }
    else{
        @:<div id="@Model.Name.Replace(" ", "-")" class="carousel">
    }
    
    var items = Model.Value<IEnumerable<IPublishedElement>>("webtickerItems");
    
    foreach (var item in items)
        { 
            <div>
                  <a href="javascript:void(0);">
                       @item.GetProperty("text").Value()
                  </a>
            </div>
         }
    
     ....
    

    This is the result for multiple calls for the partial view (different options but with the same nested content items): enter image description here

  • Wael 5 posts 96 karma points
    Apr 09, 2019 @ 02:38
    Wael
    101

    Recreating the document type for the nested content item again solved the problem.

    I don't know what is the main reason for that. maybe this happen after importing the item document type.

    I will try to reproduce this issue again to confirm the reason.

Please Sign in or register to post replies

Write your reply to:

Draft