I need to bind grid with linq to entity(asp C#), when Im binding I need to replace true or false with On or Off. how I can accomplish it?
ex.
var t = from k in entity.table select k.IsActive;
so in result if
IsActive == true I need to return On
IsActive == false I need to return Off
var t = from k in entity.table select k.IsActive ? "On" : "Off";
尝试这个
var t = from k in entity.table select k.IsActive.GetValueOrDefault() ? "On" : "Off";
你有尝试过吗?
var t = from k in entity.table select (k.IsActive ? On : Off);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.