Developer Forum »
How to get raw data from HTML property
31 posts

Is there a way to get the raw data from an HTML property (property of type HTMLPropertyClass)?

The example below will give me the value of the HTML property "BodyContent", where some of the content has been changed, like for example links have changed from "/?nid=123" to "/my-article". I would like to get the raw data without any changes to the URL-s, without having to do SQL queries.

var article = WAFContext.Request.GetContent<ArticleBase>();
string html = article.BodyContent;
181 posts

Hi!

Yes, there is a way to do it (See below), but are you sure you need to access the raw data? A lot of functionality will not work, for example WAFTags. 

var product = WAFContext.Request.GetContent<ProductBase>();
var htmlPropValue = (HTMLPropertyValue)product.GetProperty(ProductBase.PropertyIdShortDescription);
var rawHtml = htmlPropValue.GetBaseValue();
31 posts

Excellent! Thank you :)

I intend to use it only in very special situations, like exporting or synchronizing data with other applications. This way I can do an id-lookup if the urls are invalid.

1