Developer forum

Forum » Development » CustomFields not available through NewsItemDetailsTemplateExtender

CustomFields not available through NewsItemDetailsTemplateExtender

Jop Reuvers
Reply
 I'm busy building an NewsItemDetailsTemplateExtender and I want to be able to loop trhough my customfields. However in the extender I see a property called 'Item.CustomFields' but it's count is zero and so it doesn't contain any of my customfields. Below is the current extender. What is going wrong here?

Public Overrides Sub ExtendTemplate(t As Dynamicweb.Templatev2.Template)
        If t.TagExists("Innovadis:RelatedNews") Then
            Dim newsItemId As Integer = CInt(HttpContext.Current.Request("NewsId"))
            Dim newsitem As NewsV2.NewsItem = Item
            Dim b = MyBase.Item

            Dim aa = newsitem.CustomFields.Count 'is zero
            Dim bb = b.CustomFields.Count 'is zero

            t.SetTag("Innovadis:RelatedNews", "hier komt iets")
        End If
    End Sub


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer
Hi Jop,

Is this the same issue as described here: http://developer.dynamicweb-cms.com/forum/development/dw8-upgrading-customfields-prop-on-newsitem-always-0.aspx

Be aware that calling that method means another trip to the database for each news item.

Cheers,

Imar
Votes for this answer: 0

 

You must be logged in to post in the forum