I've done a lot of digging into this issue, and I've discovered the following things:
- It is true that a ContentModelSource is required to use the ContentView server control. You get an ugly .NET exception if you try to go without it.
- You are not required to actually get the data from that ContentModelSource
- Data can be set by using the
SelectMethod
property on the ContentView control. Set it to the name of a public method on your page that returns eitherContentData
orList<ContentData>
. - Alternatively, you can wait until the Page_Load event and set the
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);
}