I want to display different content based on the value of the custom field Section1CoulnCount. I have the transformation set up as Text/XML but I have also tried ASCX. this is what I'm starting with. something very simple just to see if I can get it to work. I can't :)
Section1ColumnCount is text value attached to a radio button that will either be equal to 1 or 2
<%# If(Eval(Section1ColumnCount.Value) == 2,"<div><p>Yes</p>","<div><p>No</p></div>") %> thank you for all the help as I learn
You're mixing macro syntax with ASCX syntax. Change your transformation type to ASCX and use this syntax:
<%# If(Eval<int>("Section1ColumnCount") == 2,"<div><p>Yes</p>","<div><p>No</p></div>") %>
Thank you I will try this. For my knowledge Is there a way to do this using macro syntax?
You can use the following macro to do the same thing. You need to make sure your transformation is a Text/HTML transformation type. Macro syntax is very similar to C#.
{% if(Section1ColumnCount == 2) { "<div><p>Yes</p>" } else { "<div><p>No</p></div>" } %}
Thank you!
Just one more question please. the last part of this is that now that I have the syntax of the IF statement I would like to replace the "Yes" and "No" with a form field. Can you direct me to a good reference for macro syntax?
{% if(Section1ColumnCount == 2) { "<div><p>"{% Section1_LeftSide%}"</p>" } else { "<div><p>No</p></div>" } %}
I did find the answer to my last question. I will post it here in case anybody else comes across this with the same questions. Thank you for the help. DevNet has been very helpful to me.
{% if(Section1ColumnCount == 2){ %} <div><p>{%Section1_LeftSide%}</p></div> {% } else { %} <div><p>{%Section1_RightSide%}</p></div> {% }#%}
Please, sign in to be able to submit a new answer.