日期:2014-05-17  浏览次数:20946 次

Eval()函数绑定数据时,怎么作为if判断的条件

<%if (Eval("BeTop")=="置顶")%>    
                                <%{ %>
                                <asp:ImageButton ID="imgBtn_OrderUp" runat="server" ImageUrl="~/pic/向上.jpg" CommandName="OrderUp"
                                        CommandArgument='<% #Eval("ARTICLE_ID") %>' OnCommand="RowCommand" />
                                    <asp:ImageButton ID="imgBtn_OrderDown" runat="server" ImageUrl="~/pic/向下.jpg" CommandName="OrderDown"
                                        CommandArgument='<% #Eval("ARTICLE_ID") %>' OnCommand="RowCommand" />
                                        <%} %>

我是这么写····但是就报错了····说Eval只能用于绑定数据
asp.net

------解决方案--------------------
在ImageButton外面套个<asp:PlaceHolder  runat="server" Visible='<% #Eval("BeTop") == "置顶"%>'>
或者在RowDataBound中处理