tags:

views:

295

answers:

1

I am trying to use Eval inside a IF Statement and Repeater.

I want to do something like this:

 <asp:Repeater runat="server" ID="rpRepeater">
      <ItemTemplate>
           <% if ((bool)Eval("A_Boolean"))
              { %>
                blah...
           <% } %>
      </ItemTemplate>
 </asp:Repeater>

This code gives me the following error:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

+1  A: 

Eval can be only used inside "binding" tag.

<%# Eval("A_Boolean") %>

http://support.microsoft.com/kb/307860#1a

Andrija