Click here to Skip to main content
15,905,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,


I need to check condtion inside the repeater item template using Eval How an i write the code ..this code showing error

C#
<pre lang="xml"><asp:Repeater ID="r" runat="server" DataSourceID="SqlDataSource1">

<ItemTemplate>
<%# If(Convert.ToInt32(Eval("Id"))== "1"){ %>
<li ><a href="./" class="dir"><%# Eval("ModuleName")%></a>
<ul>
<li><a href="./">aaa</a></li>
<li><a href="./">bbbb</a></li>
</ul>
<%}else {%>
<ul>
<li><a href="./">hi hi hi</a></li>
</ul>
<%} %>
</li>

</ItemTemplate>



</asp:Repeater>
Posted

1 solution

If doesn't work this way inside repeater control. Did you try Google for a solution - https://www.google.co.in/#q=if%20condition%20repeater[^]? Go through the discussions and I am sure you will find a solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900