Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
i have the following contentHome Categories Category 1 Category 2my Model is "Home" node, i want to display all the categoriesi'm trying to do the follwing
@Model.XPath("/Categories").Descandents("Category")
but i get the error
Error loading Razor Script ProjectsList.cshtmlXPath returned no nodes
do it with the normal syntax
@foreach(var cat in Model.Children){@cat.categories}
your answer doesn't make sense to mei have only one node with categories as children.
Hi, do you specifically want to use XPath? Otherwise :
@foreach(var cat in Model.Categories){@cat.Name}
i get Model.Categories as DynamicNodeList, so i needed to add .First() to the "Model.Categories", any elegant solution?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Xpath problem
i have the following content
Home
Categories
Category 1
Category 2
my Model is "Home" node, i want to display all the categories
i'm trying to do the follwing
@Model.XPath("/Categories").Descandents("Category")
but i get the error
do it with the normal syntax
@foreach(var cat in Model.Children)
{
@cat.categories
}
your answer doesn't make sense to me
i have only one node with categories as children.
Hi, do you specifically want to use XPath? Otherwise :
@foreach(var cat in Model.Categories)
{
@cat.Name
}
i get Model.Categories as DynamicNodeList, so i needed to add .First() to the "Model.Categories", any elegant solution?
is working on a reply...