15.08.2013 Views

Ektron CMS400.NET Developer Reference Manual

Ektron CMS400.NET Developer Reference Manual

Ektron CMS400.NET Developer Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Accessing Items in an Array<br />

Introduction to <strong>Ektron</strong> <strong>CMS400.NET</strong> Server Controls<br />

To access and manipulate content blocks returned by an object,<br />

use the common class <strong>Ektron</strong>.Cms.Common.ContentBase. EkItems is<br />

an array of <strong>Ektron</strong>.Cms.Common.ContentBase. EkItem is a single<br />

<strong>Ektron</strong>.Cms.Common.ContentBase.<br />

Search, Collection and ListSummary have EkItems (an array of<br />

ContentBase), while and ContentBlock have a single EkItem. Here<br />

is an example of how to use this feature.<br />

dim MyC as new <strong>Ektron</strong>.Cms.Controls.Collection<br />

MyC.DefaultCollectionID = 1<br />

MyC.Fill()<br />

dim item as <strong>Ektron</strong>.Cms.Common.ContentBase<br />

MyC.Text = ""<br />

for each item in MyC.EkItems<br />

next<br />

MyC.Text &= "" & item.Title & ""<br />

MyC.Text &= ""<br />

Response.Write(MyC.Text())<br />

Referencing the Page Property<br />

This example formats every item in the collection in a bulleted list.<br />

If a control requires a reference to its parent page (for example,<br />

utilizing the DynamicParameter property on a content block to<br />

check for a query string), you must provide access to the page<br />

object if you declared your control in the code behind. To do this,<br />

set the control's page property to the Web page you're working on.<br />

For an example, see the code in red and italics below.<br />

dim search as new <strong>Ektron</strong>.Cms.Controls.Search()<br />

MySearch.Page = me<br />

MySearch.Fill()<br />

With C#, use this syntax.<br />

<strong>Ektron</strong> <strong>CMS400.NET</strong> <strong>Developer</strong> <strong>Reference</strong> <strong>Manual</strong>, Version 5.1, Revision 5 47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!