This is a migrated thread and some comments may be shown as answers.

How do I show Yes/No for boolean columns instead of True/False?

4 Answers 1227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew Ryan
Top achievements
Rank 1
Andrew Ryan asked on 16 Oct 2009, 09:59 PM
What's the best way to show Yes/No for boolean columns instead of true false? I don't want to change it in the SQL, because it would affect my ability to query and sort.

Thanks,
Andrew

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Oct 2009, 04:48 AM
Hi Andrew,

One suggestion would be using GridTemplateColumn with Label in ItemTemplate and setting the text as shown below.

aspx:
 
<telerik:GridTemplateColumn> 
    <ItemTemplate> 
        <asp:Label ID="Label11" runat="server" Text='<%# Convert.ToBoolean(Eval("MartalStatus")) == true ? "Yes" : "No" %>'></asp:Label> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 

-Shinu.
1
Roger
Top achievements
Rank 1
answered on 15 Feb 2010, 04:48 PM

Another option is to use format

<asp:Label ID="lblcm_Active" runat="server" Text='<%# Format(Eval("BooleanField"), "Yes/No") %>'></asp:Label> 
0
Lobna
Top achievements
Rank 1
answered on 22 Mar 2014, 01:26 AM
How to make this at telerik reporting?  I have a boolean field (true or false) and I need to show it as yes/no at the report.
Is that possible?
Thanks,
0
Stef
Telerik team
answered on 26 Mar 2014, 01:47 PM
Hello Lobna,

In Telerik Reporting you can use the CheckBox item to display boolean fields, and set custom text for the True and False values. You can also use a standard reporting TextBox item, and create an expression with the built-in functions (e.g. Conditional functions)  to return the desired value based on other field.

Regards,
Stef
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Andrew Ryan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Roger
Top achievements
Rank 1
Lobna
Top achievements
Rank 1
Stef
Telerik team
Share this question
or