1
使用下面的代码,我有两个形状的结果:如何在Orchard的单个页面上显示两个形状结果?
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;
ctx.Layout.Metadata.Alternates.Add("Layout_Null");
var shapeResultLeft = new ShapeResult(this, modelLeft);
var shapeResultRight = new ShapeResult(this, modelRight);
return shapeResultLeft;
}
当我在控制器的最后一行返回任何一种形状的结果,例如return shapeResultLeft
的,浏览器完美显示该内容。但是,如何在同一页面上同时显示我的两个ShapeResults:shapeResultLeft
,shapeResultRight
?
如何退还ShapeResults的列表,并使用查看/版式文件显示呢?
能否请你告诉我什么是“通过IShapeFactory与DI注入”是什么意思?什么是DI? 。 Iam只是一个新手,我很抱歉问这个小细节 –
见方法2编辑答案 – devqon
感谢百万吨!完美地完成了上述3种方法。 –