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

Boolean Values Shown as Strings

2 Answers 366 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 06 Apr 2011, 08:57 PM
Hello,

By default, when you bind a column to a boolean value, it gets rendered as a checkbox.  Is there any built-in support to render "True" or "False" instead, or do I need to use a Value Converter?  (I just want to make sure that I have not missed some simple setting somewhere.)

Thanks,
Mark

2 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 06 Apr 2011, 09:49 PM
Hello Mark,

 

You may predefine the CellTemplate of a GridViewDataColumn, where you can place a TextBlock bound to the particular boolean property of the underlying business object, please refer to the markup below:

<telerik:GridViewDataColumn DataMemberBinding="{Binding IsActive}">
   <telerik:GridViewDataColumn.CellTemplate>
       <DataTemplate>
           <TextBlock Text="{Binding IsActive, Mode=TwoWay}"/>
       </DataTemplate>
   </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>


In case your columns are auto-generated, just handle the AutoGeneratingColumn event of RadGridVIew in an appropriate manner.


If you have any additional questions please let us know.

 

All the best,
Vanya Pavlova
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 06 Apr 2011, 10:08 PM
Hi Vanya,

That approach works perfectly too - thanks! 

Mark.
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Mark
Top achievements
Rank 1
Share this question
or