I need some help filtering on the custom property of a page. I have seen a few posts where others are doing it, but it doesn't work for me. Here is the code I am trying to get to work:
@helper MainNavAd(int menuItemID){
var topNavAdsFolder = Library.NodeById(1268);
<div class="subnav_content">
this is my subnav content from the helper method: @menuItemID -
@*topNavPage is a Content Picker*@
@topNavAdsFolder.Children.Where("topNavPage == @0", menuItemID).Count()
</div>
}
This gives me the output of: this is my subnav content from the helper method: 1059 - 0
But if i adjust the code to this:
@helper MainNavAd(int menuItemID){
var topNavAdsFolder = Library.NodeById(1268);
<div class="subnav_content">
this is my subnav content from the helper method: @menuItemID -
@*topNavPage is a Content Picker*@
@topNavAdsFolder.Children.First().GetPropertyValue("topNavPage")
</div>
}
I get the follow: this is my subnav content from the helper method: 1059 - 1059
So I feel like I am almost there. Just can't figure out how to do the filtering without looping through all the children and using GetPropertyValue to compare the custom property.
I think you just have a type comparison issue, try this:
@helper MainNavAd(int menuItemID){
var topNavAdsFolder = Library.NodeById(1268);
<div class="subnav_content">
this is my subnav content from the helper method: @menuItemID -
@*topNavPage is a Content Picker*@
@topNavAdsFolder.Children.Where("topNavPage == @0", menuItemID.ToString()).Count()
</div>
}
Filter Collection of Pages By Custom Property
I need some help filtering on the custom property of a page. I have seen a few posts where others are doing it, but it doesn't work for me. Here is the code I am trying to get to work:
This gives me the output of:
this is my subnav content from the helper method: 1059 - 0
But if i adjust the code to this:
I get the follow:
this is my subnav content from the helper method: 1059 - 1059
So I feel like I am almost there. Just can't figure out how to do the filtering without looping through all the children and using GetPropertyValue to compare the custom property.
Any help would be appreciated.
Hi Ben,
I think you just have a type comparison issue, try this:
Jeavon
That was it! Thank you so much. I knew I was missing something.
Awesome!
is working on a reply...