We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

displaying Boolean as yes or no

I am using essential grid for MVC3.I am binding a datasource that has boolean as one property.The essential grid displays the Boolean property as checkbox.I need to display it as 'true' or 'false' like that...Could you help me with this?


5 Replies

BM Bala Murugan A.S Syncfusion Team April 18, 2012 10:57 AM UTC

Hi Satheeshkumar,

Thanks for using Syncfusion Products.

We suggest you to use Format() method for the columns to display Boolean values(true or false) instead of check box. Please refer the below code snippet.

<%=Html.Syncfusion().Grid("SyncfusionGrid")
----
.Column(column => {
----
column.Add(P => P.Discontinued).HeaderText("Discontinued").Format("{0}");
})
-----
%>

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

Sample link: http://www.syncfusion.com/downloads/Support/DirectTrac/92329/Sample222748475.zip

Please try the above sample and let us know if you have any concerns.

Regards,
Bala Murugan A.S





RC rcsatheeshkumar April 26, 2012 12:19 PM UTC

Hi Balamurugan,
Thanks for your timely reply.I tried your answer,but unfortunately it displays as 0 or 1 not yes/no.

Thank you in advance.



BM Bala Murugan A.S Syncfusion Team May 7, 2012 05:50 AM UTC

Hi Satheesh Kumar,

Thanks for the update.

We are sorry for the delay in getting back to you. We are not able to reproduce your reported issue in our end. We have prepared a video of working sample and the same can be downloaded from the below link. Please have a look at the video.

Video:

https://www.syncfusion.com/downloads/Support/DirectTrac/93151/BooleanValue_JSON-950896707.zip

Please let us know if you have any concerns.

Regards,

Bala Murugan A.S



NQ Nguyen Quy Danh May 19, 2016 07:33 AM UTC

How can I display a Boolean property as checkbox?
I have a data source with boolean value and i want to ddissplay as a checkbox.



KN Kavitha Narayanan Syncfusion Team May 20, 2016 07:26 AM UTC

Hi Nguyen, 
 
Query: I have a data source with Boolean value and I want to display as a checkbox. 
By default, Grid displays the Boolean property as checkbox. So, here it is not required to set Format () method for the column  
Please refer to the code and screenshot. 
 
 
.Column(column => 
                         { 
                             column.Add(p => p.ProductID).HeaderText("Order ID").Width(90).TextAlign(TextAlignment.Right); 
                             column.Add(p => p.ProductName).Width(100); 
                             column.Add(p => p.Discontinued).Width(90);//set boolean property to this column.                          
                         }) 
 
 
 
 
For your convenience, we have prepared a sample. 
 
 
We hope it helps to resolve your issue. 
 
Regards, 
Kavitha N. 
 
 
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon