This project is read-only.

Orchard Summary View is not getting called - always getting the normal view

Topics: Core, Customizing Orchard, General
Aug 31, 2013 at 2:10 PM
This is what I want to achieve:

I have two custom Content Parts built QuestionRecord and ExpertRecord. The relation between these two parts are Experts answer to Questions posted by site users.

I have a global search module which is supposed to display a combined summary result of Questions and Expert Answers. But Expert part is somehow not picking up the Summary view, it is always showing the detail view.

 <Match ContentType="ExpertRecord">
     <Match DisplayType="Detail">
       ... ...
     <Match DisplayType="Summary">
       <Place Parts_Expert_Summary="Content:2" />
       <Place Parts_Expert="-" />

Driver Result methods in ExpertDriver:

 protected override DriverResult Display(Expert part, string displayType, dynamic shapeHelper)
        List<dynamic> questions = new List<dynamic>();
        string partName = "Parts_Expert";
        switch (displayType)
            case "Detail":
                // only load questions when showing detail record.
                questions = _questionService.GetQuestionsByExpert(part.ContentItem);
            case "Summary":
                partName += "_Summary";
        return ContentShape(partName,
            () => shapeHelper.Parts_Expert(ContentItem: part.ContentItem, Questions: questions));


@Model dynamic
<p>This is my Expert_Summary.cshtml file</p>
I want this View to be called on from the DriverResult method, but it is calling the detail view Experts.cshtml. Both views are placed in Parts folder.

I must be missing something but could not figure out what exactly it is.
I am still fairly new to Orchard so any suggestion would be a great help for me.

Sep 1, 2013 at 2:11 AM
Returned a combined shape that has both the regular and the summary versions of the shape. There are lots of examples of that technique in the core.
Sep 2, 2013 at 6:47 AM
With the Combined result the summary view is being called finally! Thanks a lot!