Developer forum

Forum » Templates » RenderItemList

RenderItemList

Morten Lund
Morten Lund
Reply

Hi

Im trying to use RenderItemList to render a list of subpages. 

Using this:

@RenderItemList(new {
    ItemType = "Page",
    ListSourceType = "Page",
    ListSourcePage = "8",
    ItemFieldsList = "*",
    ListPageSize = 100,
    ListOrderBy = "Sort",
    ListTemplate = "ItemPublisher/List/ProductPageList.cshtml",
})

 

ProductPageList.cshtml:

foreach (var listitem in GetLoop("ItemPublisher:Items.List"))
{
   string url = listitem.GetString("ItemPublisher:Item.Url");
   <li><a href="@url">@listitem.GetString("ItemPublisher:Item.PageName")</a></li>
}

 

The Page item:

systemName: Page

– and have only 1 field called PageName

 

I get an exception saying:

...Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: The column 'PageName' was specified multiple times for 't1'.
The column 'PageName' was specified multiple times for 't0'.
The column 'PageName' was specified multiple times for 't'.
...

 

What does that mean?  Is my ItemName conflicting with something? – Or am I missing something?  


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

I think the problem here is that your itemtype has a field called PageName which is a column that the builtin page table also uses...

So you have to change the systemname of that field to avoid the problem...

Sorry about that!

BR Nicolai

Votes for this answer: 1
 
Morten Lund
Morten Lund
Reply

After I changed the PageName field, it now works. Thanks Nicolai.

Please consider a check for reserved names in item fields ;)

 

You must be logged in to post in the forum