Hi
try this example to displayYes or No based on value read from DB
public string ReplaceBitValue(Object obj)
{
string returnValue = string.Empty;
if (!string.IsNullOrEmpty(obj.ToString()))
{
if (obj.ToString() == “1″)
{
returnValue = “Yes”;
}
else if (obj.ToString() == “0″)
{
returnValue = “No”;
}
}
return returnValue;
}
<asp:TemplateField HeaderText=”Status”>
<ItemTemplate>
<asp:Label ID=”status” runat=”server” Text=’<%# ReplaceBitValue(Eval(“BitField”).ToString()) %>’></asp:Label>
</ItemTemplate>
</asp:TemplateField>
//— another way —-
C#
<asp:label id=”Label1″ runat=”server” text=’<%# Convert.ToBoolean(Eval(“MyDataField”)) ? “yes” : “no” %>’ />
VB.NET
<asp:label id=”Label1″ runat=”server” text=’<%# IIf(Convert.ToBoolean(Eval(“MyDataField”)), “yes”, “no”) %>’ />
//— another way —-
<asp:Label ID=”lblEnrollDate” runat=”server”
Text=’<%# IIF(CONVERT.ToString(Eval(“IsEnrolled”))=”True”, “Yes”, “No”) %>’>
</asp:Label>
Hope this helps
Good Luck