Hi all just starting to make use of custom controllers in Umbraco and fairly new to MVC, I would like to render content in a partial view via ContentAtXPath i.e var newsArticles = Umbraco.ContentAtXPath("//news"); how do i pass content from ContentAtXPath to the partial view ?
I would like to make use of my views to only display data/content passed to it rather then get and display in the view.
I just want to know how to pass the list of new articles or list of any content to a view. Then loop through the content passed to it via a foreach statement
pass IPublishedContent to partial view
Hi all just starting to make use of custom controllers in Umbraco and fairly new to MVC, I would like to render content in a partial view via ContentAtXPath i.e var newsArticles = Umbraco.ContentAtXPath("//news"); how do i pass content from ContentAtXPath to the partial view ?
thanks Dibs
I'm not entirely shore what you mean.
Normaly I have a partial view in my template like
@Html.Partial("whatever")
On that partial you could do:
Does that answer your question?
Hi Frans
I would like to make use of my views to only display data/content passed to it rather then get and display in the view.
I just want to know how to pass the list of new articles or list of any content to a view. Then loop through the content passed to it via a foreach statement
hope that makes sense
Thanks Dibs
In that case you could do the following:
Template:
Partial view:
Although I would keep the foreach in the template and pass the child to the partial view like so:
Cheers Frans
I am now able to render content by creating a model (docType.cs) and add custom property (IEnumerable
Thanks Dibs
is working on a reply...