开发者

Ternary Operator in Gridview

I am looking to make this statement work in a VB.net page:

<asp:TemplateField HeaderStyle-CssClass="TableHeader" >
<ItemStyle Width="30px" />
<ItemTemplate>
<开发者_JS百科asp:CheckBox runat="server" ID="cbxClientsActive" 
 Text='<%# Eval("Inactive").ToString().Equals("True") ? " Not Active " : " Active " %>'
 checked='<%#Eval("Inactive")%>'/>
</ItemTemplate>
</asp:TemplateField>

The ternary operator is causing a error: Compiler Error Message: BC36637: The '?' character cannot be used here.

I want to use a tenary operator to display text based on the the field Inactive containing a true or false text value.


This is server side script code and must be written in VB.NET if the page is in that language. There is no ? operator, use the If operator instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜