Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > IsEmpty for HTML field View modes: 
User avatar
Member
Member
ctaleck IPAGlobal - 3/19/2009 1:37:49 PM
   
IsEmpty for HTML field
I need to check whether an HTML field is empty or not for a transformation:
<%# IsEmpty(Eval("OfficeDirections"),"",Eval("OfficeDirections") + "<br />") %>


However, this field always contains "<BR />" when it is empty and the code fails.

How would I test for the string instead of it being empty?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 3/20/2009 8:29:09 AM
   
RE: IsEmpty for HTML field
Hello,

You can create custom function to check if OfficeDirections field contains only <br /> tag. Please see http://www.kentico.com/docs/devguide/adding_custom_functions_to_tra.htm for more details.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
ctaleck IPAGlobal - 3/20/2009 9:50:21 AM
   
RE: IsEmpty for HTML field
Of course you can always solve a problem by writing your own code, but I bought Kentico because it was such a robust system and I didn't have write code any more!

At any rate, a little more searching and I found the command I was after: IfCompare.

See also: http://devnet.kentico.com/Forums.aspx?forumid=17&threadid=4918