Copied to clipboard

Flag this post as spam?

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


  • Connie DeCinko 931 posts 1160 karma points
    Oct 08, 2015 @ 20:36
    Connie DeCinko
    0

    DynamicNodeContext Descendants issue after upgrading to 6.2.5

    I upgraded our copy of 6.1.6 to 6.2.5 and nearly everything is working as it should. I have some content I pull for the home page like this:

    @{
      var amsUpdates = Model.Descendants("AMSUpdates").First();
    
      <div id="AMSUpdatesPanel" class="tab-pane">
        <h2>AMS Updates</h2>
        <div>
            @foreach (var item in amsUpdates.Descendants("AMSUpdate").Where("Visible").OrderBy("updateStartDateTime descending").Take(3))
            {
    

    That works correctly. I have almost the same exact code for my events and not one item is being returned:

    @{
      var barEvents = Model.Descendants("EventsCalendar").First();
    
      <div id="eventsPanel" class="tab-pane active">
        <div>
            @foreach (var item in barEvents.Descendants("Event").Where("Visible").OrderBy("eventStartDateTime").Take(5))
            {
    

    I've checked spelling, case, etc. and I cannot see a reason why the events won't display.

  • Connie DeCinko 931 posts 1160 karma points
    Oct 08, 2015 @ 22:21
    Connie DeCinko
    0

    After much hair pulling and banging my head on the desk, I tried to find the top level node by ID:

    var barEvents = @Model.NodeById("1969");
    

    Now, it all works. But, that does not correctly solve the problem, why can I not find the node like I used to with:

    var barEvents = Model.Descendants("EventsCalendar").First();
    

    The difference between the two clips above that I did not mention... The events are at level 2, one level under the home page, while the Updates parent node is at level 4.

  • Connie DeCinko 931 posts 1160 karma points
    Oct 08, 2015 @ 22:26
    Connie DeCinko
    0

    Well, I found this works. Is this the most correct/best way?

    var barEvents = @Model.EventsCalendar.First();
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies