Here is an HTML extract from my ASPX document with a data repeater control:
However, I want to display a conditional value in my ItemTemplate dependant on the Name_vc field. I want to do something like this:Code:<asp:repeater id="Repeater1" runat="server"> <HeaderTemplate> <table border="1" width="100%"> <tr> <th>Name</th> </tr> <ItemTemplate> <tr> <td><%#Container.DataItem("Name_vc")></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:repeater>
I get a compiler error message: "BC30201: Expression expected." It highlights the line I have coloured red.Code:<ItemTemplate> <td> <% If #Container.DataItem("Name_vc") = "Fred" THEN Response.Write("Your name is Fred") Else Response.Write("Your name is not Fred") End If %> </td> </ItemTemplate>
Does anybody know how I can get this to work?





Reply With Quote