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 @@@@@@@@@@@@@@@@
wats that ‘pn’ in the last line of the code ??
pn.Controls.Add(colCtrl);[Reply]
Link | March 30th, 2011 at 11:57 AM