Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Apply Transformation in code behind View modes: 
User avatar
Member
Member
jwynveen - 11/11/2013 1:25:01 PM
   
Apply Transformation in code behind
I am planning an upcoming site redesign and am anticipating some ajax functionality for data displaying to avoid the page reloads of webform postbacks. I started building a sample web part that will hit a custom MVC controller that uses the TreeHelper class to get data from the CMS and return it as JSON to the client. That I have working just fine.

My question is if there is a way to apply Transformations from code so that I can return transformed HTML as opposed to JSON (or most likely I'll have the transformed HTML as a property of a JSON object since I'll be returning an array of data). Most likely the front-end developer I am working with will use some sort of client-templating engine to do similar within the code, but it would make more sense to me to make use of the transformations within Kentico so that they are more easily editable later. However, I can't find any API reference that shows how to manually apply transformations to data. Is this something that's possible to do?

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 12/9/2013 5:09:08 PM
   
RE:Apply Transformation in code behind
Hello,

We have some powerful options in applying transformations in macro expressions (which can be resolved in code behind too), together with collections.

More technical background can be found in our CTO's blogpost "From-developers-to-developers" here on DevNet.

I would also recommend to check the Real World Examples series, where our Solution Architect shows an example JQuery AJAX / REST services based repeater, etc.

Please feel free to contact us if you have any additional questions.

Regards,
Zdenek