0

I have created a new page type called "HeroHeader". I can see that in the database it created a table for that new page type.

enter image description here

Is there a way I can access this table data from a webpart code behind?

Some thing like

var record = GetPageTypeData("HeroHeader");
var colValueById = record["HeaderId"][1];
chamara
  • 12,649
  • 32
  • 134
  • 210
  • you can just use the pages API - https://docs.kentico.com/api12sp/content-management/pages and use the DocumentHelper.GetDocuments() with the .WithCoupledColumns to get the page object data including the coupled data - https://docs.kentico.com/k12sp/custom-development/working-with-pages-in-the-api/page-database-structure – jurajo May 05 '20 at 06:16

1 Answers1

1

Yes. Check out the documentation for starters. You creat public properties in your web part which access properties in your code. Then in your code you use Document Queries to get code from page data. This is all done using C# code.

You can also use Kentico K# Macro syntax to get page data. Something like {%CurrentDocument.GetValue("ColumnName")%} will get the value of that pages field.

If you're new to Kentico you might want to check out the documentation how to use web parts and how to configure your site

Brenden Kehren
  • 5,919
  • 16
  • 27