How to get specific value

Bryant Linardy asked on June 6, 2018 10:16

i have custom table customTableExample with field name, phone, and gender how could i get value from field phone on direct page

what i expected is :

<%value of field phone%>

i still new in kentico CMS and i already googling every where but i couldnt get the answer. best regards

Recent Answers


Peter Mogilnitski answered on June 6, 2018 12:13 (last edited on December 10, 2019 02:31)

You can use macros. If you go system -> debug -> colsole - you can see all available objects and their properties. To to output a value:

  1. Go your page, switch to design tab. click on your selected zone menu and web part
  2. Add web part for example static text
  3. You can enter macro expression directly into Text property or click on a small triangle to open in new window. In the new window on the toolbar you have aceess to macro tree: {#}. You see the same tree as in the console. Click on any object in tree and it will automatically add it to the window.
  4. Go to gloabal objects -> Custom tables -> select your table. It should output something like {% GlobalObjects.CustomTables["customtable.SampleTable"] |(identity)GlobalAdministrator%} ID and Phone - your field names.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 6, 2018 13:13

The most common approach is to use a custom table repeater web part placed on a template. Configure it with the table of your choice and set the transformation name and selected transformation name to get the values displayed on a page.

Writing the above macros is a pretty "advanced" approach and not really something you want to do on your first approach to working with Kentico. Do you work for an agency? If so you can get Kentico training for free, it's a benefit.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on June 6, 2018 14:17

For start you might just take a look at the sample sites that comes with Kentico installation. For example "Corporate Site Example" contains lots of examples of web parts. You might take a look at custom table repeater web part located /Examples/Web-parts/Custom-tables/Custom-table-repeater.
P.S. You can take a look at as well Displaying data from custom tables

0 votesVote for this answer Mark as a Correct answer

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