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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

The next section of the code behind page loads the page into the<br />

browser.<br />

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As<br />

System.EventArgs) Handles MyBase.Load<br />

We want our events to occur while the page is loading, so we’ll add<br />

custom code following this line.<br />

Customizing the Server Control in the Code Behind<br />

To customize an <strong>Ektron</strong> server control in the code behind, insert<br />

code similar to the following after the Page_load command.<br />

Dim MyObj As New <strong>Ektron</strong>.Cms.Controls.ContentBlock<br />

This code declares a variable named MyObj and assigns to it the<br />

value of a content block. The content block is part of the<br />

<strong>Ektron</strong>.CMS.Controls content base, so it has access to the <strong>Ektron</strong><br />

<strong>CMS400.NET</strong> database.<br />

After defining MyObj as a content block, you can access its<br />

properties. For example, to assign a defaultID of 24, insert the<br />

following.<br />

Dim MyObj As New <strong>Ektron</strong>.Cms.Controls.ContentBlock<br />

MyObj.DefaultContentID = 24<br />

Now, the content block can be specified dynamically in the URL of<br />

the hyperlink that calls it. If not, content block 24 displays.<br />

This is just an example of programmatically applying property<br />

values to content blocks. For a complete list of properties available<br />

to <strong>Ektron</strong> <strong>CMS400.NET</strong> objects, see ”List of Server Controls” on<br />

page 61.<br />

Troubleshooting Error Creating Control Message<br />

If you get an Error Creating Control message while trying to use a<br />

server control, you can view the text of the error message by<br />

hovering the mouse over the control. See illustration below.<br />

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

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

Saved successfully!

Ooh no, something went wrong!