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

True/False to Yes/No

1 Answer 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 03 May 2011, 04:08 PM
Hello,

We bind boolean values and it translates the value to True/False (via the ToString()) method.  We often write code to translate this to Yes/No.  Is there an easy way in markup to translate the True/False to Yes/No, or does this always have to be in code?  If via the GridCheckBoxColumn, maybe?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 03 May 2011, 04:43 PM
Hello Brian,

You can use a template column and inject a declarative binding expression inside its item template like this one:

<%# ((bool)DataBinder.Eval(Container.DataItem,"Discontinued") == false ? "Yes" : "No") %>

to achieve your goal.

You can see that applied in action for our RadListView control on this live demo:
http://demos.telerik.com/aspnet-ajax/listview/examples/databinding/simplevsadvancedbinding/defaultcs.aspx

Regards,
Sebastian
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or