This project is read-only.

How to display two shape result on a single page in Orchard?

Topics: Core, Customizing Orchard, General, Writing modules, Writing themes
Sep 18, 2015 at 7:11 AM
Using below code, I have two shape results:

public ActionResult CompareRevisions(List<String> Ids)
contentItemLeft = // code to get a ContentItem
contentItemRight = // code to get a ContentItem
dynamic modelLeft = Services.ContentManager.BuildDisplay(contentItemLeft);
dynamic modelRight = Services.ContentManager.BuildDisplay(contentItemRight);
var ctx = Services.WorkContext;
var shapeResultLeft = new ShapeResult(this, modelLeft);
var shapeResultRight = new ShapeResult(this, modelRight);
return shapeResultLeft;

When I return any of one shape result such as return shapeResultLeft at the last line of Controller, the browser displays perfectly the Content. However How can I display both of my ShapeResults: shapeResultLeft , shapeResultRight on the Page same time ?

How do I return a list of ShapeResults and display it using the View/Layout file ?
Sep 18, 2015 at 3:33 PM
You could create a parent shape and either add the modelLeft and modelRight shape as children or assign them as properties. Then from your view, render either the children of the shape (using DisplayChildren) or the indivudual shape properties (Display(Model.ModelLeft) and Display(Model.ModelRight), assuming the Model is the root shape you sent back).
Marked as answer by SThangley on 9/19/2015 at 12:32 AM