gjshah7254
5/9/2014 - 5:02 AM

Simple If Condition within an Eval Statement

Simple If Condition within an Eval Statement

<%# (Eval("NewsTitle").ToString().Contains("Home")) ? "go home" : "go away" %>

<%# (Eval("Icon").ToString().Contains("PDF")) ? “do something” : “else do this” /> %>

<%# IfCompare(Eval(“SkuName”),”CompareName”,”False”,”True”)%>

<%# IfEmpty(Eval(“SkuName”),”Empty”,”Not Empty”)%>

If the field is defined as a checkbox, the default value is empty and if checked the value is true, you can use following code
<%# IfCompare(CMS.GlobalHelper.ValidationHelper.GetBoolean(Eval("boleanField"), false), true, "false result", "true result")%>