Apologises if i'm covering old ground.
I'm trying to use the IfEmpty method below without any success.
<%# IfEmpty(CurrentDocument.GetValue("OnlineGetQuoteLink"), "empty", "not empty"))%>
any help would be greatly appreciated.
So what's the problem?
Keep in mind if you're using CurrentDocument this will return value(s) from the actual page you are navigating to vs. using Eval("") which will return data from the dataset you are getting data from which could be a totally different node in the content tree. So maybe you want/need to use Eval("OnlineQuoteLink") instead.
Thanks for responding Brandon,
I still get this error: The name 'IfEmpty' does not exist in the current context
Now using <%# IfEmpty(Eval("OnlineGetQuoteLink"), "No image", "not empty") %>
Sorry, missed the title, you cannot use this in a template, this method, IfEmpty() is only available in a transformation, not templates. You'd have to use standard C# or fully namespace the method.
You can use IfEmpty method in ASPX template:
<%# CMS.Controls.TransformationHelper.HelperObject.IfEmpty(...) %>
<%@ Import Namespace="CMS.Controls" %>
<%# TransformationHelper.HelperObject.IfEmpty(...) %>
can try short IF
<%# CurrentDocument.GetValue("OnlineGetQuoteLink").ToString() = "" ? "empty":"not empty" %>
Please, sign in to be able to submit a new answer.