基于内联条件语句填充网格视图内的标签控件
我试图根据条件在 gridview 的列(包含标签)中显示纯文本。这是我的错误代码。请纠正。
<asp:Label ID="lblAsgn" runat="server" Text= '<%#Eval("StatusId") == 0 ? "NEW" : "OLD" %>' > </asp:Label>
提前致谢。
BB
I am trying to display a plain text in the column(contains a label) of gridview based on a condition. Here is my erroneous code. Please correct.
<asp:Label ID="lblAsgn" runat="server" Text= '<%#Eval("StatusId") == 0 ? "NEW" : "OLD" %>' > </asp:Label>
Thanks in advance.
BB
其中
FormatText
可以是隐藏代码中的方法:where
FormatText
could be a method in your code behind: