Aug
20
2009

Ektron Collection Control in Code behind

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading ... Loading ...

// This code is useful for creating Ektron's Collection control in Code behind of aspx/ascx

Ektron.Cms.Controls.Collection colCtrl = new Ektron.Cms.Controls.Collection();

colCtrl.DefaultCollectionID = 12; // Check this id from the Work area.

colCtrl.WrapTag = "div";

colCtrl.Visible = true;

colCtrl.DisplayXslt = "ecmTeaser"; //builtin Style

colCtrl.Page = this.Page;

XslCompiledTransform docXsl = new XslCompiledTransform();// System.Xml.Xsl

StringWriter transform = new StringWriter(); //System.IO;

docXsl.Load(Server.MapPath("xslt\\list.xslt"));

docXsl.Transform(colCtrl.XmlDoc, null, transform);

colCtrl.Text = transform.ToString();

pn.Controls.Add(colCtrl);

//@@@@@@@@@@@@@ XSLT snippetĀ  @@@@@@@@@@@@@@@@

<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="<a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a>">

<xsl:template match="/">

<ul>

<xsl:for-each select="Collection/Content">

<li>

<a>

<xsl:attribute name="href">

<xsl:value-of select="QuickLink"/>

</xsl:attribute>

<xsl:value-of select="Title"/>

</a>

<pĀ  >

<xsl:value-of select="" />

</p>

</li>

</xsl:for-each>

</ul>

</xsl:template>

</xsl:stylesheet>

//@@@@@@@@@@@@@ XSLT snippet ENDS @@@@@@@@@@@@@@@@
 

tags: ,
posted in CMS, Ektron by Sharath

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment