Multiple IF conditions in ASCX transformation

Regis Wengel asked on June 6, 2019 18:58

I'm trying to create an if else with multiple conditions in an ASCX transformation.

<%# If( GetSearchValue("ClassName") != "CMS.Press" && GetSearchValue("ClassName") != PressRelease", "True", "False" %>

Is something like this possible? I can't seem to get it to work.

Correct Answer

Brenden Kehren answered on June 6, 2019 19:27

You're better off doing a placeholder approach:

<asp:PlaceHolder ID="ph1" runat="server" Visible='<%# GetSearchValue("ClassName").ToString().Equals("your.classname") %>'>
// do work here
</asp:PlaceHolder>

<asp:PlaceHolder ID="ph2" runat="server" Visible='<%# !GetSearchValue("ClassName").ToString().Equals("your.classname") %>'>
// do work here
</asp:PlaceHolder>
0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.