This project is read-only.

Customize List Item Rendering

Topics: Customizing Orchard
May 17, 2011 at 8:44 PM


i'm new to Orchard and at the moment i'm trying to get things done.

One of my problems is to customize the Rendering of a custom content type in a list. I've built a special "ImageGallery" ContentType of some standard parts, an ImageField and two TaxonomyFields. Basically everything works fine. Now I want to customize the rendering of my ListItem. I can access the Image- and Textfields without problems. When I try to render the Taxonomy-Fields in my Template, then I've no chance to access the Terms collection.

I've installed the Orchard Designer Tools to view my Model-Structure. There I realized that the field properties of both Taxonomy-Fields doesn't contains this Terms collection. How can I access those properties through my model? I know that I can render an alternative layout of my TaxonomyField, but I need it customized in my special view.

Best regards,


Jul 7, 2011 at 4:57 PM

Hello uhillig,

Did you ever find a solution for this, I am facing the same problem as I have created a custom view for the list I am rendering but cannot access the taxonomy term. I can access the taxonomy as a TaxonomyField but this does not expose any properties for the TermPart?

Jul 7, 2011 at 7:57 PM

Does this discussion answer your problem ?

Jul 8, 2011 at 7:32 AM

Hi danmce,

Yes i found a solution, but I'm not sure if it the best solution.

Generally I've created a special summary view for my content type. In this view i iterate over the available shapes in Model.Content and try to find one shape with a Terms-collection. With this terms collection I'm able to render the Taxonomy parts the way i like.

It looks something like that:

        @foreach(var shape in Model.Content)
                var terms = shape.Terms;
                if (terms != null)
                    var count = 0;
                        <span>@shape.ContentField.Name: </span>
                        @foreach (Contrib.Taxonomies.Models.TermPart termPart in terms)
                            if (count > 0){
                                <span>, </span>
                            count = count + 1;

Hope this helps.

Best regards,