Search code examples
ektron

Getting HTML of Smart Form Content in Ektron


I am working in Ektron 8.0.

I have created a smart form configuration in Settings,I assigned this particular smart form configuration for a Folder and created a Smart form content.Now i am trying to access the Smart Form content programmatically. I am getting the "XML" data as the content.Html property.Is there is any way i can get the HTML data corresponding to a smartform content,rather than these XML data?


Solution

  • There are a few ways to this, here are two.

    XSLT:

     <CMS:ContentBlock runat="server" Visible="true" DisplayXslt="/xmlfiles/SmartForm.xslt" DefaultContentID="23" />
    

    The SmartForm.xslt file translates the xml into formatted html.

    Use XSD to access SmartForm Content on the code behind.

    This article explains the process. http://developer.ektron.com/Templates/KBDetail.aspx?id=603

    You need to get a copy of the .xsd file and use it to create an object definition for your smart form.

    Use the xsd.exe tool to create a class. The command looks like this.

    "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe" "C:\inetpub\site\xsd\SmartFormContet.xsd" /classes /language:CS /namespace:SmartForm.SmartFormContent
    

    This will generate a class file named SmartFormContet.cs

    Copy this file and paste into the code behind of the page.

    Deserialize the XML from the Content.Html property.