Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Transformation Examples */
- // Ternary example
- <%# !string.IsNullOrEmpty((string)Eval("ItemToTest")) ? "True" : "False" %>
- <%# !string.IsNullOrEmpty((string)Eval("CatalogLink")) ? "<p>For detailed curriculum and more, please visit the <a href=\"" + Eval("CatalogLink") + "\" target=\"_blank\">Course Catalog entry</a> for this program.</p>" : Eval("CatalogDescription") + "<br /><br /><strong>For detailed curriculum and more please visit the <a onclick=\"_gaq.push(['_trackEvent', 'Link', 'Click' 'Course Catalog Adult Education'])\" target=\"_blank\" href=\"" + Eval("CatalogLink") + "\">Course Catalog entry</a> for this program.</strong><br />" %>
- // IfEmpty
- <%# IfEmpty(Eval("Image"), "", "<img src=\"" + Eval("Image") + "\" class=\"alignright\" alt=\"" + Eval("DocumentName") + "\" />") %>
- <%# IfEmpty(Eval("Download"), "", "<a href=\"" + Eval("Download") + "\" class=\"btn icon-download\" target=\"_blank\">Download</a>") %>
- // Macro Resolver
- <a href="<%# CMSContext.ResolveMacros( Eval("URL").ToString() ) %>"><%# Eval("Name") %></a>
- // Visbility
- <p runat="server" Visible='<%# Eval<string>("Name") != "some-value" %>'>
- <cms:QueryRepeater ID="qrConcentrations" runat="server"
- Visible='<%# isCurrentPage(Eval<String>("nodeAlias"))%>'
- QueryName="custom.DegreePrograms.GetConcentrationsBySchoolModalityAndCategory"
- TransformationName="custom.degreeprograms.concentrations"
- OrderBy="v1.DegreeName ASC"
- PagerControl-PagerHTMLBefore="<li>"
- PagerControl-PagerHTMLAfter="</li>">
- </cms:QueryRepeater>
- /* transformation: check if first record */
- <%# DataItemIndex == 0 ? "First record" : "Not first record" %>
- /* transformation: check if last record */
- <%# DataItemIndex == DataRowView.DataView.Count - 1 ? "Last record" : "Not last record" %>
- /* K# Examples */
- // If statement
- {% if (CurrentDocument.RelatedTitlesHeader == "") { "Related Books" } else { CurrentDocument.RelatedTitlesHeader } %}
- {% if (bizFormField != null) { "<p>$$value:bizFormField$$</p>" } %}
- // nested if statement
- {% if (CMSContext.CurrentDocument.RelativeURL == "~/georgia/rate-quote") { GetResourceString("MHI.RateQuote.Georgia") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/indiana/rate-quote") { GetResourceString("MHI.RateQuote.Indiana") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/oklahoma/rate-quote") { GetResourceString("MHI.RateQuote.Oklahoma") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/south-carolina/rate-quote") { GetResourceString("MHI.RateQuote.SouthCarolina") }}}} #%}
- /* WebPart Visibility */
- // Do NOT show if DocumentName is equal to "Home"
- {%DocumentName|(notequals)Home|(truevalue){?param?}%}
- // Do NOT show if NodeID is equal to "211"
- {%NodeID|(notequals)211|(truevalue){?param?}%}
- // Hide page(s) in the /Landing-Pages directory
- {%CMSContext.CurrentDocument.NodeAliasPath|(Contains)Landing-Pages|(not)#%}
- // Show if DocumentName is equal to "Home"
- {%DocumentName|(equals)Home|(truevalue){?param?}%}
- // Show if path contains
- {%Contains(CMSContext.CurrentDocument.NodeAliasPath, "Landing-Pages")#%}
- // Show if path does not contain
- {%!Contains(CMSContext.CurrentDocument.NodeAliasPath, "Landing-Pages")#%}
- // Visibility based on Wildcard value
- {%QueryString["County"] != ""%}
- // Date format
- <%# GetDateTime("BlogPostDate", "D") %>
- /* String replace */
- // Kentico: Transformation, string replace, tolower
- <%# Eval("DocumentName").ToString().Replace(" ", "-").ToLower() %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement