Developer forum
E-mail notifications
RenderItem() and RenderItemList()
Replies
Hi Kevin,
RenderItem
Are you using Items as Pages or Items as Paragraphs? If you have always teh same DW page you can build your URL pointing to a hardcoded page ID or to a navigation tag
Something like this:
var url = "Default.aspx?Id=" + GetPageIdByNavigationTag("MyNavigationTagForMyItems") + "&ItemId=" + GetString("ItemPublisher:Item.ID");
This should give you the necessary url (I typed the tag, please confirm)
And the GetFriendlyUrl method does not work if you have a '/' charater, so you need to start with 'Default.aspx'
RenderItemList
You have mixes concepts there. Are you trying to get all Items from a specific source or specific items?
I believe what you're looking for is this
(I took your first example and rendered it immediately (not assigning it to a variable) and made ListSourcePage an integer (not a string).
Hope this helps,
Nuno Aguiar
Hi Nino, thanks for this. Items as Paragraphs, I want all [Paragraph] Items of type "Case_Study" that are on PageID=62 Ordered by created date.
I dont have this method: Line 1076: The name 'GetPageIdByNavigationTag' does not exist in the current context. What Namespace is this in or is it your own? I have a similar utility method that does somthing like this:
Dynamicweb.Content.Page page = Dynamicweb.Content.Page.GetPagesByAreaID(areaId).Where(n => n.NavigationTag == PageTagName).FirstOrDefault();
But it seems a shame we have to leap through these hoops when in the RenderItemList we actually supply the ListSourcePage = 62
So your adaption of my version of @RenderItemList does not work for me nothing is rendered. Is there something that needs to be done in the list template (Im using the current List template I use in the Item Publisher module)??
My DW version is 8.9.2.6
Hi Kevin,
RenderItem
>> dont have this method: Line 1076: The name 'GetPageIdByNavigationTag' does not exist in the current context
Right, that's an issue. You can simply supply "62". That will make it hardcoded. You can also try to get it from a area setting (item as website properties for example), which is a lot simpler than Dynamicweb.Content.Page page = Dynamicweb.Content.Page.GetPagesByAreaID(areaId).Where(n => n.NavigationTag == PageTagName).FirstOrDefault(); and it's still make it dynamic.
RenderItemList
If your items are paragraphs, try adding the last parameter in bold underline below.
@RenderItemList(new { ItemType = "Case_Study", ListSourceType = "Page", ListSourcePage = 62, ItemFieldsList = "*", ListTemplate = "ItemPublisher/List/Case Study List.cshtml", ListPageSize = "100", IncludeParagraphItems = true })
I don't know if there's anything wrong in the list template. I'd have to see it too. One thing you can do is add @TemplateTags() on the (list) template to ensure you get the expected number of loop items and other expected tags. If you are getting no results in the templates, it means there's something wrong with the settings above. If you are getting results but they are not displaying, then the issue with related to the template itself.
Best Regards,
Nuno Aguiar
You must be logged in to post in the forum