Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joseph 12 posts 32 karma points
    Nov 25, 2010 @ 01:27
    Joseph
    0

    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>
    }

  • Kim Andersen 1447 posts 2197 karma points MVP
    Nov 25, 2010 @ 16:56
    Kim Andersen
    0

    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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies