Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control
问题 I am getting the following error Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. but all I am trying to do is inside a ASP.NET REPEATER Control <% if ( Eval("Message").ToString() == HttpContext.Current.Profile.UserName) %> <% { %> <asp:ImageButton runat="server" etc.... /> <% } %> 回答1: The syntax is <%# Eval("...") %> You could do something like <asp:ImageButton Visible='<%# ShowImg(Eval(Container.DataItem,"Message")) %>' /> and