Kentico is a great platform for creating and maintaining your entire site and data. Occasionally, you may have some data that existing before your site was created, or is just disconnected in some way. With Kentico v7’s
Custom Table functionality, you can easily register these tables in your system. This gives a ton of advantages like being able to create standard Kentico Queries and Transformations with CMS controls.
Let’s say you have a non-Kentico table full of information you HAVE to have on yours site.
Registering your table
You will want to register this table within Kentico to leverage queries and transformations to display on your site.
In CMS Site Manager / Development / Custom Tables click “New Table”
- On Step 1, Enter the preferred table name / code name
- On Step 2, select "Use an existing table"
- Select you table from the list of available tables.
- Only tables that have a primary key and are not currently associated with a Kentico object will be available.
- Decide if you want to add the Kentico fields to your table.
- These fields are necessary if you want to use content staging, however, they will create columns in your table.
- Select Existing Table
- Continue with configuring your table’s search and security settings.
- Confirm you can view you table data from the site
Add your data to your site
Now that you have your table registered you can use standard CMS controls to interact with the data.
Custom Table Transformation
Add a repeater to your page and set your properties.
Custom Table Repeater
After that, you’re set! Go forth and avenge Thundera!
Custom Table Display
Deleting the table
As part of this blog I wanted to make you aware of an important aspect to Custom Tables. Whether a table is creating using the Kentico interface or registering an existing table, deleting a custom table will physically delete your table from the database. This obviously would have disastrous consequences on your data if you decided to un-register the table for some reason in the future and still needed the data. Be sure to backup first!