Although there are several questions on this topic, I haven't found any satisfactory answers.
I have a Repeater that needs to display complex content. An IF statement is required within the template. I can't move this to the code-behind as I need to have server controls and user controls registered within the repeater. Here is what I need:
<asp:Repeater ID="rCom" runat="server" ClientIDMode="Static">
<ItemTemplate>
<%# If CBool(Eval("IsFix")) Then%>
<%-- HTML content including server and user controls --%>
<%Else%>
<%-- HTML content including server and user controls --%>
<%End If%>
</ItemTemplate>
</asp:Repeater>
The above throws a compiler error. Any idea on how to achieve this? I need to evaluate the IsFix field in the If statement.
Anonymous User
02-Jun-2015Remove # from the code nuggets which is having if statement:-
Edit:
Try with conditional operator (I am not sure about the syntax in VB.NET, please check):-
<%# If(CBool(Eval("IsFix")), "Do Something", "Else do something" %>