Convert int value to "Yes" : "No"

May 23, 2013 at 9:21 PM
Edited May 23, 2013 at 9:45 PM
In mvc 4, is it possible to change the display of a bit value to either "Yes" or "No"? I've been able to to successfully do this outside of the grid using

@(Model.Enabled == 0 ? "No" : "Yes")

I tried doing the same in the grid column like this but received an error stating it was not supported:

columns.Add(model => (model.Enabled == 0 ? "No" : "Yes")).Sortable(true).Filterable(true);

Is there another format I can use to accomplish this?

Thanks so much!


Sorry I'm very new to MVC and coding in general but I figured out how to solve the above issue. I changed the column line to :

columns.Add(model => model.Enabled).RenderValueAs(model => model.Enabled == 0 ? "No" : "Yes").Sortable(true).Filterable(true);

Thanks again...the grid is very awesome!!!
Sep 5, 2016 at 5:25 PM
Hi there, did you get a solution to this problem ?