Hi
I'm not that familiar with ascx transformations. I'm trying to convert following transformation to ascx, but I'm constantly fighting errors. I guess I'm running in circles at the moment :)
I'm trying to render all form fields, including their attachments (2 fields contain attachments)
<%#
docAttachments = Documents[NodeALiasPath].AllAttachments;
return;
%>
<%# if (docAttachments.Any()) { %>
<div class="product_detail_content">
<a class="product_detail_content-link" data-toggle="collapse" href="#product-content-2" aria-expanded="false" aria-controls="collapseExample">
<h2>{$ REN.ProductTechnicalFiles $}</h2>
<span class="fa fa-caret-down"></span>
</a>
<div class="collapsed in product_detail_content-text" id="product-content-2">
<div class="product-detail-tech">
<%#
foreach (attachment in docAttachments ) {
if (attachment.AttachmentExtension.Trim(".") != "png") {
"<a class='cta__button' href='/getattachment/" + attachment.AttachmentGUID + "/" + attachment.AttachmentName + "' target='_blank'>"
+ "<span class='icon-" + attachment.AttachmentExtension.Trim(".") + "'></span>"
+ attachment.AttachmentName +
"</a>";
}
}
#%>
</div>
</div>
</div>
<div class="product_detail_content">
<a class="product_detail_content-link" data-toggle="collapse" href="#product-content-3" aria-expanded="false" aria-controls="collapseExample">
<h2>{$ REN.ProductTechnicalDrawings $}</h2>
<span class="fa fa-caret-down"></span>
</a>
<div class="collapsed in product_detail_content-text" id="product-content-3">
<div class="product-detail-drawing">
<%#
foreach (attachment in docAttachments ) {
if (attachment.AttachmentExtension.Trim(".") == "png") {
"<a class='cta__button' href='/getattachment/" + attachment.AttachmentGUID + "/" + attachment.AttachmentName + "' target='_blank'>"
+ "<span class='icon-" + attachment.AttachmentExtension.Trim(".") + "'></span>"
+ attachment.AttachmentName +
"</a>";
}
}
#%>
</div>
</div>
</div>
<%# } %>
How do I declare variables known throughout the current transformation;
example: docAttachments = Documents[NodeALiasPath].AllAttachments;
error: [TempITemplate.Template]: http://server/CMSVirtualFiles/Transformations/=vg=71bc1b86-7d88-499a-a38c-6d4288d36c2c/REN.ProductDetail/ProductDetailsLeft.ascx(9): error CS0103: The name 'Documents' does not exist in the current context
for strings or translations I've found an ascx solution. But now I need to get the attachments from a specific field
<%
string subTitleContent1 = Localize("REN.ProductAdvantages");
%>
<h2><%= subTitleContent1 %></h2>
So I guess there has to be another way to iterate through all the attachments