Yes it's possible to write ASP in your templates, but you have to omit the code in <% %>, otherwise it won't work.
But in your case you shouldn't have to do this check, because an umbraco:item just won't be rendered if the field that should be rendered is empty. You can allso choose a second field, that should be rendered if your primary field is empty, if that's what you want to do.
Can you add control (if this do this) in a template?
I have a template like this:
<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<umbraco:Item field="text" runat="server"></umbraco:Item>
</asp:Content>
Is there a way to check if "text" has a value eg using pseudo code
if(text.Length > 0)
{
<umbraco:Item field="text" runat="server"></umbraco:Item>
}
Hi Joseph
Yes it's possible to write ASP in your templates, but you have to omit the code in <% %>, otherwise it won't work.
But in your case you shouldn't have to do this check, because an umbraco:item just won't be rendered if the field that should be rendered is empty. You can allso choose a second field, that should be rendered if your primary field is empty, if that's what you want to do.
/Kim A
is working on a reply...