Reputation: 5222
I have a item in a listView control like this
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Open") %>' />
The 'open' is coming from a database via linq to sql. The open can either have a value of Y, or N. I want it to say instead 'Open' or 'Closed'.
What is the best way to do this? Can I do it in the mark up?
Upvotes: 2
Views: 198
Reputation: 68717
<%#Eval("Open") == "Y"? "Open" : "Closed" %>
But if those are the only possible values, you might want to consider changing the type to a bit.
Upvotes: 1