ASCX transformation code (Kentico 7)

Craig Browder asked on February 17, 2016 17:30

I am trying to build a transformation that will switch between video players. I have the following code in the transformation. when I try to preview, I get an error that the content is not available. can someone take a look at this code to see if anything stands out?

Thanks. Craig

<% if(Eval("Link").ToString().Contains("brightcove")) { %> <li class="sixcol sixcol-small<%# ((DisplayIndex)%2==0 ? " first" : "") %>"> <a href="<%# Eval("Link") %>" onClick="window.open(this.href,'video','top=50, left=50, width=800, height=500, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no'); return false;" class="video-thumb" title="<%# Eval("Name") %>"> <img src="/chamberlain/media/library/images/blank.gif" alt="<%# Eval("Name") %>" /> <a class="video-title video-link" href="<%# Eval("Link") %>" onClick="window.open(this.href,'video','top=50, left=50, width=800, height=500, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no'); return false;" title="<%# Eval("Name") %>"><%# Eval("Name") %>
<% } else { %> <li class="sixcol sixcol-small<%# ((DisplayIndex)%2==0 ? " first" : "") %>"> <a href="<%# Eval("Link") %>" class="video-thumb fancybox-video" title="<%# Eval("Name") %>"> <img src="/chamberlain/media/library/images/blank.gif" alt="<%# Eval("Name") %>" /> <a class="video-title video-link fancybox-video" href="<%# Eval("Link") %>" title="<%# Eval("Name") %>"><%# Eval("Name") %> <% } %>

Recent Answers


Dawid Jachnik answered on February 18, 2016 09:01

Hello,

try this: I changed you condition only:

<% if (ValidationHelper.GetString(Eval("Link"),"").Contains("brightcove"))
{ %>
<li class="sixcol sixcol-small<%# ((DisplayIndex)%2==0 ? " first" : "") %>">
<a href="<%# Eval("Link") %>" onclick="window.open(this.href,'video','top=50, left=50, width=800, height=500, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no'); return false;" class="video-thumb" title="<%# Eval("Name") %>">
    <img src="/chamberlain/media/library/images/blank.gif" alt="<%# Eval("Name") %>" />
    <a class="video-title video-link" href="<%# Eval("Link") %>" onclick="window.open(this.href,'video','top=50, left=50, width=800, height=500, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no'); return false;" title="<%# Eval("Name") %>">
        <%# Eval("Name") %>
        <% }
        else { %>

<li class="sixcol sixcol-small<%# ((DisplayIndex)%2==0 ? " first" : "") %>">
<a href="<%# Eval("Link") %>" class="video-thumb fancybox-video" title="<%# Eval("Name") %>">
    <img src="/chamberlain/media/library/images/blank.gif" alt="<%# Eval("Name") %>" />
    <a class="video-title video-link fancybox-video" href="<%# Eval("Link") %>" title="<%# Eval("Name") %>">
        <%# Eval("Name") %>
        <% } %>

If this doesn't help, paste here your error with stack trace.

BTW. Why you use html element "a" insinde another "a" ? It's not correct.

3 votesVote for this answer Mark as a Correct answer

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