Go back to mobile site

 

Please note: The forums are currently intended for Kentico community. Although we monitor them time to time, we cannot guarantee a timely response. If you need a help with Kentico CMS, please feel free to send your message to support@kentico.com.

If you want to add new post or reply to post, please sign in.

Search: 

Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Ifcompare with boolean data type View modes: 
User avatar
Member
Member
pete_s - 10/12/2011 3:44:33 AM
     
Ifcompare with boolean data type
Hi,

If I use the following in a transformation:

<%# IfCompare(Eval("Testfield"),0,"No","Yes") %>

And testfield is a boolean datatype, what should I be putting in the comparison field? I've tried 0,-1, 1, etc but nothing seems to work.

Thanks,

Pete

User avatar
Kentico
Kentico
kentico_ivanat - 10/12/2011 4:04:19 AM
     
RE:Ifcompare with boolean data type
Hi,

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")%>

Best regards,
Ivana Tomanickova


User avatar
Member
Member
pete_s - 10/12/2011 5:42:34 AM
     
RE:Ifcompare with boolean data type
Worked a treat, many thanks!

Pete

1

Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2013 Kentico Software | Powered by Kentico CMS