Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i have a boolean field in my model in mvc 4 entity framework 4.5

i want to display the field in my view

i use this call

@item.isTrue

but i got true or false,

i want to get yes when true and no when false

what should i do please?

question from:https://stackoverflow.com/questions/20338154/mvc-model-boolean-display-yes-or-no

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
280 views
Welcome To Ask or Share your Answers For Others

1 Answer

In your view:

@(item.isTrue?"Yes":"No")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...