DDL 显示“真/假”;我想看看“是/否”数据以 bool 形式形成表。如何更改 DDL 的文本
我有一个 DDL 显示任务是否完成。在表中它存储为 bool,所以当它出来时它是 true 或 false。我想构建我的 DDL 以在 true 时显示 yes,在 false 时显示 no。有人有任何提示吗:)这就是我到目前为止所拥有的。
IEnumerable<SelectListItem> items =
(from n in _db.ACTION_PLANs
select new SelectListItem
{
Selected = false,
Text = n.COMPLETED.Value.ToString(),
Value = n.COMPLETED.Value.ToString(),
}
).Distinct();
ViewData["COMPLETED"] = items;
有没有办法放置一个条件语句,以便文本根据真或假显示是或否?或者我怎样才能做到这一点。提前致谢
i have a DDL that shows if a task is completed. in the table it is stored as bool, so when it comes out it is true or false. i would like to build my DDL to show yes when true and no when false. does anyone have any hints :) this is what i have so far.
IEnumerable<SelectListItem> items =
(from n in _db.ACTION_PLANs
select new SelectListItem
{
Selected = false,
Text = n.COMPLETED.Value.ToString(),
Value = n.COMPLETED.Value.ToString(),
}
).Distinct();
ViewData["COMPLETED"] = items;
is there a way to put a conditional statement so that the text will display yes or no depending on the true or false? or how can i make this happen. thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这没有本地化,但很简单
this has no localization, but is simple
试试这个:
Try this:
这行得通吗?
Will this work?