Displaying data from module class on live site

Fred John asked on March 15, 2016 10:20

Hello!

I am very new to Kentico and I got myself stuck on something that probably has a really simple solution.

I have a custom module, which has a class. I can see/add/edit records from that class in the portal. What I am trying to do is show those records on the site as well (for example, on the home page. so not portal). Here I am having some issues because:

I noticed that for displaying list/records people usually use repeaters. I managed to make a data source web part in order to feed the information to the repeater, but I am having issues making the transformation (which seems to be mandatory).

What I've been looking at: https://docs.kentico.com/display/K9/Writing+transformations On that page it says that you can only do transformations for page types and custom tables (I understand that custom tables are something completely different from custom modules). And, if I try and make a transformation on my site using the portal, I only get the possibility to select page types or custom tables, not custom modules classes.

However, here: https://docs.kentico.com/display/K9/Loading+data+using+custom+queries Says these steps have to be applied for loading data even if the data comes from custom modules classes, and step 3 is to assign transformation. By this I understand that there must be a way to make a transformation for custom modules classes.

Am I missing something? Am I looking at this the wrong way?

Thank you for your time.

Correct Answer

David te Kloese answered on March 15, 2016 10:27

Hi,

If you use the Basic Repeater you'll be able to insert the "Data source name" as setting.

In the Transformation could you try using something like:

<%# Eval("YourCustomFieldName", true) %>

Greets,

David

2 votesVote for this answer Unmark Correct answer

Recent Answers


Fred John answered on March 15, 2016 10:49

Thank you David!

I did use the basic repeater and I had the Data source figured out. My problem was that I couldn't select the class in the options of the transformation. Now I just selected another random item there and just wrote the fields of my class and it worked!

I previously just assumed that it would fail. My bad, I should never assume anything.

Thanks again for the help!

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 15, 2016 11:18

Hi,

The class you select is the location under which it will save the Transformation. For this sort of transformations (or queries) not directly linked to any type I usually create a custom type "CustomTransformations" or something like that.

Glad I could help!

Greets,

David

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.