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
Hi,
I have used articulate package for blog. I wanted to know how to write partial view to fetch data or value of properties. Below is the screenshot:
These properties are in Archive.
var root = Umbraco.TypedContentAtRoot().Single(x => x.DocumentTypeAlias == "Articulate");
<h1>@root.GetPropertyValue("name")</h1>
<h1>@root.GetPropertyValue("blogDescription")</h1>
Iam able to fetch property values for blog but not for archive.
Thanks,
Manasa
Hi Manasa,
I have had time to have a look at this, and try to find a solution for you, and I think for you.
Try to use this code and see if it works for you.
@{ var root = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateArchive").FirstOrDefault(); <h1>@root.GetPropertyValue("name")</h1> <h1>@root.GetPropertyValue("blogDescription")</h1>}
Hope this helps,
/Dennis
Thanks a lot Dennis :).
It worked
You are welcome. Glad that I could help you.
By the way please remember to mark the question as solved :-).
Dennis,
If i gotta loop for multiple times, how can I do it. Coz when I tried
@{
var blogs = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateRichText").FirstOrDefault();
foreach(var blog in blogs) {
<h4><a href="@blogs.Url" target="_top">@blogs.Name</a></h4>
<p>@blogs.GetPropertyValue("publishedDate")</p>
<p>@blogs.GetPropertyValue("excerpt")</p>
}
I get a error. foreach statement cannot operate on Umbraco.Core.Models.IPublishedContent .
Hi Manasa.
Try this snippet of codes and see if it gives you the results that you want.
@{ var blogs = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateArchive").FirstOrDefault(); foreach (var blog in blogs.Children.Where(x => x.IsVisible())){ <h4><a href="@blog.Url" target="_top">@blogs.Name</a></h4> <p>@blog.GetPropertyValue("publishedDate")</p> <p>@blog.GetPropertyValue("excerpt")</p> }}
Cooll... Worked.. Thanks a lot :)
You´re welcome glad that I could help you.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Macro to fetch property values.
Hi,
I have used articulate package for blog. I wanted to know how to write partial view to fetch data or value of properties. Below is the screenshot:
These properties are in Archive.
var root = Umbraco.TypedContentAtRoot().Single(x => x.DocumentTypeAlias == "Articulate");
<h1>@root.GetPropertyValue("name")</h1>
<h1>@root.GetPropertyValue("blogDescription")</h1>
Iam able to fetch property values for blog but not for archive.
Thanks,
Manasa
Hi Manasa,
I have had time to have a look at this, and try to find a solution for you, and I think for you.
Try to use this code and see if it works for you.
Hope this helps,
/Dennis
Thanks a lot Dennis :).
It worked
Hi Manasa,
You are welcome. Glad that I could help you.
By the way please remember to mark the question as solved :-).
/Dennis
Dennis,
If i gotta loop for multiple times, how can I do it. Coz when I tried
@{
var blogs = Umbraco.TypedContentAtRoot().DescendantsOrSelf("ArticulateRichText").FirstOrDefault();
foreach(var blog in blogs) {
<h4><a href="@blogs.Url" target="_top">@blogs.Name</a></h4>
<p>@blogs.GetPropertyValue("publishedDate")</p>
<p>@blogs.GetPropertyValue("excerpt")</p>
}
}
I get a error. foreach statement cannot operate on Umbraco.Core.Models.IPublishedContent .
Thanks,
Manasa
Hi Manasa.
Try this snippet of codes and see if it gives you the results that you want.
Hope this helps,
/Dennis
Cooll... Worked.. Thanks a lot :)
Hi Manasa,
You´re welcome glad that I could help you.
/Dennis
is working on a reply...