I dont know of a way of doing this, but you can set a secondary feild to use if the specified feild is empty, you can also set some static text to use if neither of these feilds hold any content.
<umbraco:Item field="bodyContent" useIfEmpty="abstract" textIfEmpty="There is no content available" recursive="true" runat="server"></umbraco:Item>
Firstly if there is no content then the control will not render, isn't that what you want?
If you do want to do some kind of check you can do it in the code behind, check the status of a property and then set the control's visibility to be false.
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>
}
I dont know of a way of doing this, but you can set a secondary feild to use if the specified feild is empty, you can also set some static text to use if neither of these feilds hold any content.
<umbraco:Item field="bodyContent" useIfEmpty="abstract" textIfEmpty="There is no content available" recursive="true" runat="server"></umbraco:Item>
Hope this helps
Firstly if there is no content then the control will not render, isn't that what you want?
If you do want to do some kind of check you can do it in the code behind, check the status of a property and then set the control's visibility to be false.
e.g.
<umbraco:Item field="bodyText" runat="server" ID="bodyTextControl" />
I'm guessing this would be more useful if you wanted to do some other check before rendering than checking that there is content though.
is working on a reply...