linking custom transformations to a page type

ruben verschueren asked on October 8, 2018 15:03

I just created a datasource (ascx) and want to use a list web part, for instance basic repeater, to display the data. To do that I created a transform (ascx) and want to use it in the repeater, but I cannot select it.

After searching the documentation I found that I need to add a transform to the page type. I can add a new one, but it expects the code body to be in Kentico. So my question is how can I add a transform that is located in a file not in the database to a page type?

Recent Answers


Brenden Kehren answered on October 8, 2018 15:26

Typically if you have external data, you create a placeholder for the transformations and queries in a Container Only Page Type. This creates a page type without any custom fields. It allows you to create transformations and add in your custom transformation code which is not dependent on any field names. Then when you go to assign that transformation in your basic repeater, select the "Transformations Only" page type and you'll see the transformation you created.

0 votesVote for this answer Mark as a Correct answer

ruben verschueren answered on October 8, 2018 15:57

Hi Brenden, thanks for your fast reply. It sounds logical, but I think I'm missing something. I feel like an idiot, but still don't see how Kentico will recognize the transformation ascx file I created.

So now I have the following created in VS and deployed to my website

  • A custom datasource, EmployeeDatasource.ascx
  • A list web part which references the datasource and populates it, EmployeeList.ascx
  • A EmployeeListTransform.ascx which is a file in my Visual Studio solution that get's deployed to the website folder.

In Kentico I added the following * A container page type named CVManager.ContainerPageType * A web part called employeeList, which references my EmployeeList.ascx * A page that includes the EmployeeList webpart and a basic repeater.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 8, 2018 16:02

Unfortunately, the way you're dong it all (100% in code) won't work with the way I'm explaining. Lets take a step back, what is the query you're creating? Is it within the same Kentico database or another database?

Typically there's no reason to create a custom basic repeater and hook it to custom datasource. The datasource would be the only custom webpart needed and I'd even question that.

0 votesVote for this answer Mark as a Correct answer

ruben verschueren answered on October 8, 2018 16:08

I'm creating a CV Manager as a test case to get to know Kentico. I've created a custom module with classes and some custom tables to input all the data.

So no I want to display a list of all my employee's on an overview page and after selecting one I would go to a detail page which displays all relevant data in a CV type format.

The datasource and transform etc. I was talking about is for the employee list on the overview page.

If it's not possible to do it all in code, that's fine for me. I'm just testing out how I could do it a 100% in code. I'm not going to make the entire thing in ASPX, but will do this again in MVC when Kentico 12 has arrived (full release).

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 8, 2018 16:15

Sounds like you're using 2 different things: custom module classes and custom tables. You might want to read former Kentico MVP Roman Hutnyk article on the difference between them and when to use one over the other.

You can do nearly 95% of what you're talking about with simply configuring the base Kentico webparts utilizing custom tables without any kind of special module. Even in K12 with MVC you can use custom tables to accomplish the same thing.

0 votesVote for this answer Mark as a Correct answer

ruben verschueren answered on October 9, 2018 08:28

Hi Brenden. I used classes where I needed more complex relations and for the base objects or where I wanted to create some more interesting UI. I might not be the most efficient way to do it, but as I said it's just an exercise to test the possibilities of Kentico. Here are a few images of my set up. The UI isn't user friendly and I probably need to clean up the custom tables a bit.

Image Text

Image Text

Image Text

0 votesVote for this answer Mark as a Correct answer

Suneel Jhangiani answered on October 9, 2018 11:34

Since you are doing this in a custom module you would not necessarily require an Employee datasource and transformation. This is because you are creating a UI within the admin area of Kentico.

What you should do is look at the Object Listing and potentially create an extender - there is a good article at https://devnet.kentico.com/articles/module-development-ui-extenders

I highly recommend you look at how the Ecommerce module is structured and how it lists the Customer and Orders - you will note that you can open the Orders app directly or from within a specific customer and both take you to the same code.

0 votesVote for this answer Mark as a Correct answer

ruben verschueren answered on October 9, 2018 14:01

Thanks Suneel, I'll look into that. once this first list is working I'm switching to version 12 (beta probably) and trying it MVC style. So my next questions will probably about exporting, staging, CI and upgrading :-)

0 votesVote for this answer Mark as a Correct answer

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