Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Apply If condition in transformation View modes: 
User avatar
Member
Member
mukesh.laxkar-octalsoftware - 3/14/2012 1:28:08 AM
   
Apply If condition in transformation
Hi,

I want to apply If condition like
<% if(condition)
{}
%>


but it gives error.
can you tell me how is possible.

thanks.

User avatar
Kentico Support
Kentico Support
kentico_janh - 3/14/2012 3:20:05 AM
   
RE:Apply If condition in transformation
Hello,

You can use the IfCompare(object value, object comparableValue, object falseResult, object trueResult) method for it:

<%# IfCompare(1, 2, "The values are different", "The values are equal") %>

This method compares values of the first and the second parameter. If the parameters are different or are both NULL, the third parameter is returned. If they are equal, the fourth parameter is returned.

Best regards,
Jan Hermann