mvc • Kentico.Net CMS - martindubenet/wed-dev-design GitHub Wiki

Kentico-cms

Sharing front-end development knowledge to design within Kentico's portal engine webapp


Transformations references

This is a resumé of the official Kentico documentation available here: Kentico#10, K#11

Boolean conditional operations

method coded example
If <%# If(Eval("IsSecuredNode"),"If true do this","If false do that") %>
IfCompare <%# IfCompare(1, 2, "The values are different", "The values are equal") %>
IfEmpty <%# IfEmpty(Eval("PictureExample"), "No image", GetImage("PictureExample")) %>
IfTrue <%# IfTrue(Eval("Example"), "If true do this") %>
IsFirst <%# IsFirst("This is the first item of the list, so add a <ul> tag before") %>
IsLast <%# IsLast("This is the last item of the list, so add a closing </ul> tag after") %>
IsCurrentDocument <%# IsCurrentDocument() %>
IsDocumentOnSelectedPath <%# IsDocumentOnSelectedPath() %>

Data loading

The 2nd parameter is optional (false by default) = <%# Eval("Example", false) %>

coded method default false description
<%# Eval("Example") %> Returns the value as an object data type. Use only for ASCX transformations.
<%# Eval<string>("Example") %> Use only for ASCX transformations. <string> = columnName
<%# EvalCDATA("Example") %>
<%# EvalJSString("Example") %> Encodes the returned text to be used in JavaScript code, encapsulated within '
<%# GetEditableValue("Example") %> Specify the region using the control ID (web part control ID)
<%# GetNotEmpty("Example1;Example2") %> Returns the value of the first data column that is not empty or null. The parameter must provide a list of column names separated by semicolons.
<%# GetColumnName("Example") %> Returns the value of the first column that is present in the data of the transformed object. The parameter must provide a list of column names separated by semicolons. By default, the method only returns columns that are not null or empty. Set the optional second parameter to true to allow empty values.
<%# DataItem %> Gets the currently transformed data item.
<%# DataItemIndex %>
<%# DataItemCount %>
<%# DataRowView %>
<%# DisplayIndex %>
<%# DocumentCustomData["Example"] %> Gets the value of custom page data fields (culture specific). Use the ["nodename"] notation to retrieve data stored in the specified node of the XML.
<%# EditableItems["Example"] %> Gets the content of the specified editable region on the page.
<%# NodeCustomData["Example"] %> Gets the value of custom page data fields (shared for all culture versions). Use the ["nodename"] notation to retrieve data stored in the specified node of the XML.
⚠️ **GitHub.com Fallback** ⚠️