Copied to clipboard

Flag this post as spam?

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


  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 11:10
    umbracocool
    0

    Because I get a zero value Descendants in Razor with Umb 4.11.5?

    Hello friends, look I have this code, which calls for a node and tries to get all descendants called "Car". The problem is that this returning 0 and I do not know why, since I have like 4 cars at nodes descendants. Help please and tried everything and it does not work. : (: (: (

     

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

    <umbraco:Macro runat="server" language="cshtml">
    @Model.NodeById("1091").Descedants("Car").Where("Visible").Count() 
    umbraco:Macro>

    <asp:ContentPlaceHolder Id="Content" runat="server">
      
    asp:ContentPlaceHolder>

    asp:Content>


  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2013 @ 11:20
    Fuji Kusaka
    0

    Try this instead

    <umbraco:Macro runat="server" language="cshtml">
    @{
     var t = @Model.NodeById("1091").Descedants("Car").Where("Visible"); 
    foreach(var c in t){
    @c.Name
     }
    }
    <umbraco:Macro>
     
  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 15:10
    umbracocool
    0

    Thanks for answering. No, it shows absolutely nothing!. :(  :( 

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2013 @ 15:17
    Fuji Kusaka
    0

    Opps not Desedants but Descendants

  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 15:53
    umbracocool
    0

    Thanks for answering. No, it shows absolutely nothing!. :(  :(  Oh my God!

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2013 @ 15:56
    Fuji Kusaka
    0

    Still nothing ? Weird. Do you have umbracoNaviHide set to true in yout content section ? 

  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 16:36
    umbracocool
    0

    No, I have not set anything "umbracoNaviHide" ... I'm desperate with this that bad for me. My friend, can you give me your email to gmail, to show my website to see if you can spot the problem?. I greatly appreciate. And then you ask the solution here.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2013 @ 16:45
    Fuji Kusaka
    0

    Drop me an email here [email protected] ill have a look 

  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 16:47
    umbracocool
    0

    Right!

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2013 @ 17:22
    Fuji Kusaka
    100

    Looks like you are using the wrong DocTypeAlias here. You should be using Dealer-Vehiculo instead of Car.

    Descendants("docType")
  • umbracocool 108 posts 197 karma points
    May 23, 2013 @ 17:25
    umbracocool
    0

    The problem has been fixed. Sometimes you are very stressed and can not think straight ... was inadvertently assigning the "Id" wrong and had; "Descedants" instead of "Descendants". My consjeoe s well as to review and write your code as assigned. haha

     

    Thanks Fuji!

Please Sign in or register to post replies

Write your reply to:

Draft