Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys
I've got a question please: how do I display embed code entered into a field of type Textbox multiple in my template.
My field has and ID of 'embedCode'. My template code is below and when I view the page the second bit of code is the code that works:
The bit of code that doesn't work:
if(Model.HasValue("embedCode"))
{
@Model.embedCode
}
It ends up rendering:
umbraco.MacroEngines.DynamicXml
I would really appreciate any help I can get as I'm trying to get rid of these server side components and replace it with razor code instead.
Many thanks in advance :)
Full page code below:
<%@ Master Language="C#" MasterPageFile="~/masterpages/MMasterTemplate.master" AutoEventWireup="true" %>
<asp:content ContentPlaceHolderId="ContentPlaceHolder_HeadContent" runat="server">
</asp:content>
<asp:content ContentPlaceHolderId="ContentPlaceHolder_PageContent" runat="server">
<umbraco:Macro runat="server" language="cshtml">
@{
if((Model.HasValue("mainImage")) && (Model.HasValue("mainImageLink")))
<div class="largeImg">
<a href="@Model.mainImageLink">
<img src="@Model.MainImage" />
</a>
</div>
else if((Model.HasValue("mainImage")) && (!Model.HasValue("mainImageLink")))
if(Model.HasValue("bodyText"))
<div>
@Model.bodyText
<div class="embedCodeUpper">
</umbraco:Macro>
<div class="embedCode"><umbraco:Item field="embedCode" runat="server" /></div>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to display embed code of type Textbox multiple in my template
Hi guys
I've got a question please: how do I display embed code entered into a field of type Textbox multiple in my template.
My field has and ID of 'embedCode'. My template code is below and when I view the page the second bit of code is the code that works:
The bit of code that doesn't work:
if(Model.HasValue("embedCode"))
{
@Model.embedCode
}
It ends up rendering:
umbraco.MacroEngines.DynamicXml
I would really appreciate any help I can get as I'm trying to get rid of these server side components and replace it with razor code instead.
Many thanks in advance :)
Full page code below:
<%@ Master Language="C#" MasterPageFile="~/masterpages/MMasterTemplate.master" AutoEventWireup="true" %>
<asp:content ContentPlaceHolderId="ContentPlaceHolder_HeadContent" runat="server">
</asp:content>
<asp:content ContentPlaceHolderId="ContentPlaceHolder_PageContent" runat="server">
<umbraco:Macro runat="server" language="cshtml">
@{
if((Model.HasValue("mainImage")) && (Model.HasValue("mainImageLink")))
{
<div class="largeImg">
<a href="@Model.mainImageLink">
<img src="@Model.MainImage" />
</a>
</div>
}
else if((Model.HasValue("mainImage")) && (!Model.HasValue("mainImageLink")))
{
<div class="largeImg">
<img src="@Model.MainImage" />
</div>
}
if(Model.HasValue("bodyText"))
{
<div>
@Model.bodyText
</div>
}
if(Model.HasValue("embedCode"))
{
<div class="embedCodeUpper">
@Model.embedCode
</div>
}
}
</umbraco:Macro>
<div class="embedCode"><umbraco:Item field="embedCode" runat="server" /></div>
</asp:content>
is working on a reply...