convert a boolean to Yes/No in a ASP.NET GridView
VB:
<asp:TemplateField HeaderText="Active" SortExpression="Active">
<ItemTemplate>
<%#If(Boolean.Parse(Eval("Active").ToString()), "Yes", "No")%>
</ItemTemplate>
</asp:TemplateField>
C#:
<asp:TemplateField HeaderText="Active" SortExpression="Active">
<ItemTemplate>
<%# (Boolean.Parse(Eval("Active").ToString())) ? "Yes" : "No" %>
</ItemTemplate> </asp:TemplateField>
Comments
Post a Comment