1

I have this code in my listview:

<td>
<asp:TextBox ID="Used_For_Neighborhood_AnalysisTextBox" runat="server" Text='<%# Bind("[Used For Neighborhood Analysis]") %>' /> 
</td>

I would like to check if this value equals Yes then make it --Yes-- in bold.

4

1 回答 1

0
<style>
    .myYes { font-weight: bold; }
</style>

<asp:TextBox ID="TextBox1" runat="server" 
    Text='<%# Convert.ToBoolean(Eval("[Used For Neighborhood Analysis]").ToString()) ? "--Yes--" : "" %>'
    CssClass='<%# Convert.ToBoolean(Eval("[Used For Neighborhood Analysis]").ToString()) ? "myYes" : "" %>'>
</asp:TextBox>

你想使用Eval。否则,您将不得不在 OnItemDataBound 内进行绑定。

作为一个好的做法,请避免在列名中使用空格。

于 2013-02-20T20:47:41.347 回答