Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个控件,其可见属性设置为布尔字段的值。但是,我希望可见性与布尔字段相反。我该怎么做呢?
此代码显示设置为字段值的可见属性。我想否定这个价值。
<span runat="server" id="toMonthYear" visible='<%#Eval("isAttending")%>'> <%#Eval("toMonthName")%> </span>
只需将其转换为bool并使用否定运算符(NOT在 VB.NET 中)。
bool
NOT
Visible='<%# !(bool)Eval("isAttending") %>'
尝试这个
<span runat="server" id="toMonthYear" visible='<%#(!Boolean.Parse(Eval("isAttending"))%>'>