Ektron Collection Control in Code behind

August 20, 2009

// 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 @@@@@@@@@@@@@@@@
Share and Enjoy:
  • Twitter
  • Google Buzz
  • DZone
  • Digg
  • Reddit
  • Diigo
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • Mixx
  • email
  • PDF
  • Add to favorites

tags: ,
posted in CMS, Ektron by sharath

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

1 Comment to "Ektron Collection Control in Code behind"

  1. afeera wrote:

    wats that ‘pn’ in the last line of the code ??
     
    pn.Controls.Add(colCtrl);

    [Reply]

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org