如何在aspx c#中使用EVAL条件使用IF ELSE

时间:2020-04-05 11:37:28

标签: c# asp.net eval

我正在尝试使用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>
<% } %>

1 个答案:

答案 0 :(得分:0)

您可以按照以下方式使用methot

string

相关问题