However in my custom render, i want to query a list of nodes to render as a menu but since this inherits from the UmbracoViewPage it doesnt seem to work the same way i used to in an UmbracoTemplatePage.
Here is my code:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<dynamic>
@{
var postNodes = Model.Content.AncestorOrSelf("Home").Descendants("Testimonial")
.Where(i => i.IsVisible()).Take(1);
if (postNodes != null)
{
<section class="testimonials center">
@foreach (var post in postNodes)
{
var text = post.GetPropertyValue<string>("bodyText", recurse: true);
<blockquote>@text</blockquote>
<span class="testimonial-attribution prominent">@post.Name</span>
}
</section>
}
}
Error:
error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
How to query nodes in a Custom Grid Editor?
I was using this tutorial to create a custom editor https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/build-your-own-editor
However in my custom render, i want to query a list of nodes to render as a menu but since this inherits from the UmbracoViewPage it doesnt seem to work the same way i used to in an UmbracoTemplatePage.
Here is my code:
Error: error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
Hi Steve, You could just use the Current Page to Query through.
var CurrentPage = Umbraco.Content(umbraco.NodeFactory.Node.GetCurrent().Id);
Here I have used the Node Factory to get the Current Node ID and Used the Umbraco helper to get the Published Content. Now I have the Current Node.
Here I have Used the AncestorOrSelf(level) to navigate back to the Root that is given as 1(Root Level is 1).
Using Descendants I have tried to find all documents of the Document Type alias ("Testimonials").
Document Type Alias is case sensitive. Please do check if you are passing the correct document type alias..
Take 1 does what it does in asp.net.; it takes one out of all those results.
Hope this helps.
is working on a reply...