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

Display string instead of boolean

2 Answers 423 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 07 Dec 2015, 05:55 PM
I have a RadGridView that I populate with a DataTable. One of the fields that is in the DataTable is a column that contains boolean values. Instead of showing "True" or "False" in the column like it does now, I want it to show "In" or "Out". What is the simplest way to accomplish this? I am using Visual Studio 2013 and programming in Visual Basic. Thanks!

2 Answers, 1 is accepted

Sort by
0
Cyril
Top achievements
Rank 1
answered on 08 Dec 2015, 07:40 AM

Hello,

 You can use cellformating event with this code inside:

if e.cellelement.value = true then

    e.cellelement.text = "in";

else

     e.cellement.text = "out";

end if

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Dec 2015, 11:38 AM
Hello Charles,

Thank you for writing.

The suggested approach by Cyril is one possible option. Indeed, the CellFormatting event gives you the opportunity to customize the text displayed in the cell. Another option is to use a custom TypeConverter and convert the boolean value to the desired string if the cell value is displayed in a GridViewTextBoxColumn. Feel free to use this approach which suits your requirement best.

I am looking forward to your reply.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Charles
Top achievements
Rank 1
Answers by
Cyril
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or