The ContentBlock server control displays the following types of content blocks on an Web page.
A static content block displays one identified content block on a Web page. The following image shows a server control that retrieves content block ID=28 and displays it in the browser.
The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.
Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.
The number of seconds that the server control’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See Also: Caching with Server Controls.
The ID of a content block that appears where you insert this server control. If you don’t know the ID number of the content block, use the CMS Explorer to browse to it. See Also: Browsing Your Ektron Site Using CMS Explorer
NOTE: If you identify a content block that displays an Office document which will be published as HTML, make sure the template sets <span>
tags to display the content as a block.
Ignore for a non-XML content block.
By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.
Select None - Use Default. This parameter is used for dynamic content blocks.
Hides or displays the output of the control in design time and run time.
Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).
Suppresses the output of the span/div tags around the control.
WARNING! If you want to let content authors edit this content using Ektron’s Edit in Context feature, this must be set to false.
Lets a developer specify a server control’s tag.
Use a dynamic content block to display a content block whose ID is passed through a URL parameter. You would use this server control with a dynamic template.
The following example shows how you can use the ContentBlock server control to pass the id as a URL parameter. When a user clicks a link that passes the content block ID as a URL parameter, that content block appears. If that content block is not available, content block 1 appears
The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.
Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.
The ID of a content block that appears where you insert this server control. If you don’t know the ID number of the content block, use the CMS Explorer to browse to it. See Also: Browsing Your Ektron Site Using CMS Explorer
NOTE: If you identify a content block that displays an Office document which will be published as HTML, make sure the template sets <span>
tags to display the content as a block.
Ignore for a non-XML content block.
By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.
Select id. When you do, this server control uses the content block passed as a URL parameter.
Hides or displays the output of the control in design time and run time.
Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).
Suppresses the output of the span/div tags around the control.
WARNING! If you want to let content authors edit this content using Ektron’s Edit in Context feature, this must be set to false.
Lets a developer specify a server control’s tag.
Use an XML content block to display an XML content block on an Ektron Web page.
The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.
Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.
The number of seconds that the server control’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See Also: Caching with Server Controls.
The ID of a content block that appears where you inserted this server control if no other content block is identified, or is not available. If you don’t know the ID number of the content block, use the CMS Explorer to browse to it. See Also: Browsing Your Ektron Site Using CMS Explorer
If desired, enter a relative or absolute path to an Xslt that determines the display of the page. If you do not define the DisplayXslt
property, the OverrideXslt
property specifies an XSLT identified in the Edit Smart Form Configuration screen. See Also: Working with Smart Forms
WARNING! If you specify an external file, do not store this file in the Workarea folder. If you store this file in the Workarea folder, the file will be lost when you upgrade.
By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.
To make this content block dynamic, select id. When you do, this server control uses the content block passed as a URL parameter.
Hides or displays the output of the control in design time and run time.
Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).
Suppresses the output of the span/div tags around the control.
Lets a developer specify a server control’s tag.
Retrieving the XML structure of XML content allows for greater control over developing XSLs. The following example shows how to retrieve the XML structure.
WARNING! This does not work with HTML content blocks, as there is no XML structure to output.
TextMode
property to MultiLine.NOTE: On the code-behind page, add the following line.
TextBox1.Text = ContentBlock1.EkItem.Html
The following code displays a content block:
NOTE: Before adding these lines of code, drag and drop a literal box on your Web form.
Dim MyContentBlock As New ContentBlock MyContentBlock.DefaultContentID = 8 MyContentBlock.Page = Page MyContentBlock.Fill() Literal1.Text = MyContentBlock.EkItem.Html
To display a content block with the content block title:
NOTE: Before adding these lines of code, drag and drop a 2 literal boxes on your Web form.
Dim MyContentBlock As New ContentBlock MyContentBlock.DefaultContentID = 8 MyContentBlock.Page = Page MyContentBlock.Fill() Literal1.Text = MyContentBlock.EkItem.Title Literal2.Text = MyContentBlock.EkItem.Html