我正在尝试使用if else
条件在aspx页面中使用Eval
条件。但是它在else
条件下显示错误红线,在)
条件下显示if
。
代码
<div class="price_mth text-center">
<% if (string.IsNullOrEmpty(Eval("PromoPrice", "{0:,00}").ToString()) %>) { %>
<asp:panel id="pricePanel" runat="server" >
<h2><i class="fa fa-usd" aria-hidden="true"></i> <%# Eval("Price", "{0:,00}") %><sup>.00/mo</sup></h2>
</asp:panel>
<% } %>
<% else { %>
<asp:panel id="promopanel" runat="server">
<div class="style-1">
<h2> <del><i class="fa fa-usd" aria-hidden="true"></i> <span class="amount"><%# Eval("Price", "{0:,00}") %></span> </del><sup>.00/mo</sup></h2>
<h2><ins><i class="fa fa-usd" aria-hidden="true"></i> <span class="amount"><%# Eval("PromoPrice", "{0:,00}") %></span></ins><sup>.00/mo</sup></h2>
</div>
</asp:panel>
<% } %>
您可以如下使用methot
<asp:Panel ID="p1" Visible='<%#BLL.Logic.ShowPanel(Eval("PromoPrice", "{0:,00}")) %>' runat="server">