Reading DynamicContent in code behind

Vote:
 

I have a page type based on the Long String > 255, that has a DynamicContent property to display a site wide value on the web page. The value is displayed when the following is used on the ASPX page

<EPiServer:Property ID="propIntro" PropertyName="MainIntro" runat="server" />    

Is there a way of getting the value of the DynamicContent property in the code behind, as we use the first 100 characters of this field as the teaser text on the listing (branch) page. I can get the value with

PropertyData intro = page.CurrentPage.Property["MainIntro"];
if (intro != null && !intro.IsNull)
{
   ltlIntro.Text = intro.ToWebString();
}

    

#45740
Nov 15, 2010 18:32
Vote:
 

Ted Nyberg posted about parsing dynamic content from code, rather than from a property.  This might be what you're looking for:

http://tedgustaf.com/en/blog/2009/9/parse-an-episerver-xhtml-property-with-dynamic-content/

#45741
Nov 15, 2010 18:42
Vote:
 

I just posted this, related to this discussion:

Simple Token Replacement
http://world.episerver.com/Blogs/Deane-Barker/Dates/2010/11/Simple-Token-Replacement/

Based on what you're doing, this might be a good fit.

#45744
Nov 15, 2010 20:27
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.