0

The following code renders a textbox inside of a column and fills the textbox with the value of a DESCRIPTION field:

<asp:TemplateColumn HeaderText="Notes.LBL_LIST_DESCRIPTION" SortExpression="DESCRIPTION" ItemStyle-Width="20%" >
        <ItemTemplate>
                <asp:TextBox ID="DESCRIPTION" BorderWidth="0" BorderStyle="none" ReadOnly="true" CssClass="dataField" Text='<%# Eval("DESCRIPTION") %>' TextMode="MultiLine" Rows="2" Width="200px" TabIndex="11" runat="server" />
        </ItemTemplate>
</asp:TemplateColumn >  

I want to append the description with the text "[DELETED]" in red if the value of the field DELETED (a bit field) equals 1.

How can I do this?

Thank you.

1 Answer 1

2

Instead of appending, I just added a span:

<%# Sql.ToInteger(DataBinder.Eval(Container.DataItem, "DELETED")) == 1 ? "<span style='color: red;'>[Deleted]</span>" : "" %>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.