gjshah7254
4/7/2015 - 4:31 AM

ASP Placeholder Examples in Transformation

ASP Placeholder Examples in Transformation

//Checks if 2 fields are Empty or Not
<asp:Placeholder runat="server" visible='<%# (!String.IsNullOrEmpty(Eval("UsefulLink1").ToString())) || (!String.IsNullOrEmpty(Eval("UsefulLink2").ToString())) %>' ></asp:Placeholder>

//Empty String Check
<asp:Placeholder runat="server" visible='<%# !String.IsNullOrEmpty(Eval("UsefulLink2").ToString()) %>' ></asp:Placeholder>

//For checkbox field or any other Boolean field
<asp:Placeholder runat="server" visible='<%# "True".Equals(Eval("Checkbox").ToString()) %>' ></asp:Placeholder>

//Placeholder for only non-logged in members
<asp:Placeholder runat="server" visible='<%# "True".Equals(CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%currentuser.userid|(equals)65|(truevalue)True|(falsevalue)False#%}")) %>' ></asp:Placeholder>	

//First Item in Transformation
<%# "True".Equals(DataItemIndex==0?"True":"False") %>

//Below code is used to compare a field with other field or with a specific text (String Compare)
'<%# (Eval("FirstDataType")).Equals("None") %>


//More Examples
<%# ((string)Eval("ShowImageOnly1")=="html"?true:false) %>