[英]vb.net inline IF with OR… not evaluating
我正在處理一個小問題,試圖根據兩個條件顯示/隱藏面板
不幸的是,這似乎不適用於我(請注意,設置一個或另一個條件就可以了。)
<asp:Panel runat="server" Visible='<%#If(Not String.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "_236")) Or Not DataBinder.Eval(Container.DataItem, "_236") = "Not Relocatable", True, False)%>'>
<tr>
<td>
</td>
<td class="align-right lightgreen">
Buyer would consider relocating a business, if it is:
</td>
<td>
</td>
<td colspan="3">
<%#DataBinder.Eval(Container.DataItem, "_236")%>
</td>
<td>
</td>
</tr>
</asp:Panel>
誰能幫我解決這個問題?
語法<%# %>
是數據綁定語法,而不是內聯表達式語法。 您不能像在嵌入式代碼<% %>
標記中那樣使用其中的過程代碼。
數據綁定標簽必須包含單個Eval
或Bind
函數。 如果需要基於這些功能進行條件分支,則需要使用綁定標記周圍的內聯代碼來進行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.