Simple Grid Boolean Value Yes/No from DB or CustomYes/CustomNo

15. September 2009

Read this article in your language IT | EN | DE | ES

I'm just putting this up here so I have it somewhere when I forget.

Sometimes I pull data from my database from a Bit column or boolean column and want to display more then True/False.

With a simple statement you can make it say anything you want.

<asp:TemplateField HeaderText="Is Active">
<ItemTemplate>
<asp:Label id="lblActive" runat="server" Text='<%#IIf(Boolean.Parse(Eval("Active").ToString()), "Yes", "No")%>' />
</ItemTemplate>
</asp:TemplateField>

ASP.NET, Code Snippets ,