The examples I'm seeing for the new ContentView templated server control all use a ContentModelSource server control on the front end. What if I have a method already created that uses the FrameworkAPI and sets all sorts of weird filters in the criteria object and returns a List<ContentData>
. Is there a way I can pass that list of content data into my ContentView server control and totally skip having any sort of ContentModelSource control on the page?
I've done a lot of digging into this issue, and I've discovered the following things:
SelectMethod
property on the ContentView control. Set it to the name of a public method on your page that returns either ContentData
or List<ContentData>
.Model.ContentList
property. You get a .NET exception (Null Reference, i think) if you try to set it during Page_Init.ASPX:
<ektron:ContentModelSource runat="server" ID="cmsNull"></ektron:ContentModelSource>
<ektron:ContentView runat="server" ID="cvPrimary" ModelSourceID="cmsNull">
</ektron:ContentView>
C#:
protected void Page_Load(object sender, EventArgs e)
{
var cm = new ContentManager();
var criteria = new ContentCriteria();
criteria.AddFilter(ContentProperty.Type, CriteriaFilterOperator.EqualTo, EkEnumeration.CMSContentType.Content);
cvPrimary.Model.ContentList = cm.GetList(criteria);
}